| Differences between
and this patch
- a/Source/WebCore/ChangeLog +277 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2019-03-26  Said Abou-Hallawa  <said@apple.com>
2
3
        Remove the SVG tear off objects for SVGLength, SVGLengthList and SVGAnimatedLengthList
4
        https://bugs.webkit.org/show_bug.cgi?id=196083
5
6
        Reviewed by Simon Fraser.
7
8
        -- SVGLength will be a superclass of SVGValueProperty<SVGLengthValue>. It
9
           is a wrapper of SVGLengthValue. It will be provide the DOM methods. It
10
           can setValueAsString() and return valueAsString().
11
12
        -- SVGLengthList will be a superclass of SVGValuePropertyList<SVGLength>.
13
           The base class will provide all the DOM methods. SVGLengthList will be
14
           responsible for parsing a String to a SVGLength items. It can also 
15
           build a string representing the stored items.
16
17
        -- SVGAnimatedLengthList will be defined as SVGAnimatedPropertyList<SVGLengthList>.
18
           Like SVGAnimatedPointList, all the required methods and attributes
19
           will be handled by SVGAnimatedPropertyList.
20
21
        -- SVGAnimatedLengthAccessor and SVGAnimatedLengthListAccessor will be
22
           added to access the members of types SVGAnimatedLength and 
23
           SVGAnimatedLengthList.
24
25
        -- SVGAnimatedLengthAnimator and SVGAnimatedLengthListAnimator will be
26
           created by the the new accessors to animate attributes of types
27
           SVGAnimatedLength and SVGAnimatedLengthList.
28
29
        -- SVGAnimationLengthFunction and SVGAnimationLengthListFunction will be
30
           responsible for progressing the animVal() of attributes of types
31
           SVGAnimatedLength and SVGAnimatedLengthList.
32
33
        -- SVGValuePropertyAnimator is a new template class which can animate a
34
           none reflecting attribute which should be backed by a value property,
35
           e.g. SVGLength.
36
37
        -- SVGValuePropertyListAnimator is a new template class which can animate a
38
           none reflecting attribute which should be backed by a value property
39
           list, e.g. SVGLengthList.
40
41
        Notes:
42
43
            -- SVGElement::isAnimatedStyleAttribute() will return true if the
44
               attribute is known by SVGPropertyAnimatorFactory. Or it's has 
45
               a reflecting SVGAnimatedPropertyLength property and its name is
46
               one of the names listed in isAnimatedStylePropertyAttribute() of
47
               the propertyRegistry() of the SVGElement.
48
49
            -- SVGElement::commitPropertyChange() has to handle the attributes
50
               for which isAnimatedStylePropertyAttribute() returns true different
51
               from the other ones. styleReclac() needs updated attributes since
52
               it does not access the reflecting properties in the SVGELement.
53
54
            -- SVGTextContentElement does not need a customized SVGAnimatedLength.
55
               All SVGTextContentElement::textLengthAnimated() needs to know is
56
               whether m_textLength->baseVal() holds an empty SVGLength. If it
57
               does, it sets its value to getComputedTextLength().
58
59
        * Sources.txt:
60
        * WebCore.xcodeproj/project.pbxproj:
61
        * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
62
        (WebCore::updateCharacterData):
63
        (WebCore::SVGTextLayoutAttributesBuilder::fillCharacterDataMap):
64
        * svg/SVGAnimateElementBase.cpp:
65
        (WebCore::SVGAnimateElementBase::hasValidAttributeType const):
66
        * svg/SVGAnimatedLength.cpp: Removed.
67
        * svg/SVGAnimatedLength.h: Removed.
68
        * svg/SVGAnimatedLengthList.cpp: Removed.
69
        * svg/SVGAnimatedLengthList.h: Removed.
70
        * svg/SVGAnimatedType.h:
71
        (WebCore::SVGAnimatedType::type const):
72
        * svg/SVGAnimationElement.cpp:
73
        (WebCore::SVGAnimationElement::isTargetAttributeCSSProperty):
74
        (WebCore::inheritsFromProperty):
75
        * svg/SVGAnimatorFactory.h:
76
        (WebCore::SVGAnimatorFactory::isSupportedAttribute):
77
        (WebCore::SVGAnimatorFactory::create):
78
        These changes were required because some of the tests were trying to
79
        animated unsupported attributes. To differentiate between between the
80
        these two cases:
81
            1) the attribute is animate-able by the legacy controller.
82
            2) animating the attribute or the attribute itself is not supported
83
               by the element.
84
85
        We want SVGAnimatorFactory tell us whether it can create an animator for
86
        a given attribute or not.
87
88
        * svg/SVGCircleElement.cpp:
89
        (WebCore::SVGCircleElement::SVGCircleElement):
90
        (WebCore::SVGCircleElement::parseAttribute):
91
        (WebCore::SVGCircleElement::svgAttributeChanged):
92
        (WebCore::SVGCircleElement::registerAttributes): Deleted.
93
        * svg/SVGCircleElement.h:
94
        * svg/SVGCursorElement.cpp:
95
        (WebCore::SVGCursorElement::SVGCursorElement):
96
        (WebCore::SVGCursorElement::parseAttribute):
97
        (WebCore::SVGCursorElement::svgAttributeChanged):
98
        (WebCore::SVGCursorElement::registerAttributes): Deleted.
99
        * svg/SVGCursorElement.h:
100
        * svg/SVGElement.cpp:
101
        (WebCore::SVGElement::commitPropertyChange):
102
        (WebCore::SVGElement::isAnimatedStyleAttribute const):
103
        * svg/SVGElement.h:
104
        * svg/SVGEllipseElement.cpp:
105
        (WebCore::SVGEllipseElement::SVGEllipseElement):
106
        (WebCore::SVGEllipseElement::parseAttribute):
107
        (WebCore::SVGEllipseElement::svgAttributeChanged):
108
        (WebCore::SVGEllipseElement::registerAttributes): Deleted.
109
        * svg/SVGEllipseElement.h:
110
        * svg/SVGFilterElement.cpp:
111
        (WebCore::SVGFilterElement::SVGFilterElement):
112
        (WebCore::SVGFilterElement::registerAttributes):
113
        (WebCore::SVGFilterElement::parseAttribute):
114
        * svg/SVGFilterElement.h:
115
        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
116
        (WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
117
        (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
118
        (WebCore::SVGFilterPrimitiveStandardAttributes::registerAttributes): Deleted.
119
        * svg/SVGFilterPrimitiveStandardAttributes.h:
120
        (WebCore::SVGFilterPrimitiveStandardAttributes::x const):
121
        (WebCore::SVGFilterPrimitiveStandardAttributes::y const):
122
        (WebCore::SVGFilterPrimitiveStandardAttributes::width const):
123
        (WebCore::SVGFilterPrimitiveStandardAttributes::height const):
124
        (WebCore::SVGFilterPrimitiveStandardAttributes::xAnimated):
125
        (WebCore::SVGFilterPrimitiveStandardAttributes::yAnimated):
126
        (WebCore::SVGFilterPrimitiveStandardAttributes::widthAnimated):
127
        (WebCore::SVGFilterPrimitiveStandardAttributes::heightAnimated):
128
        (WebCore::SVGFilterPrimitiveStandardAttributes::isKnownAttribute): Deleted.
129
        * svg/SVGForeignObjectElement.cpp:
130
        (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
131
        (WebCore::SVGForeignObjectElement::parseAttribute):
132
        (WebCore::SVGForeignObjectElement::registerAttributes): Deleted.
133
        * svg/SVGForeignObjectElement.h:
134
        * svg/SVGImageElement.cpp:
135
        (WebCore::SVGImageElement::SVGImageElement):
136
        (WebCore::SVGImageElement::parseAttribute):
137
        (WebCore::SVGImageElement::registerAttributes): Deleted.
138
        * svg/SVGImageElement.h:
139
        * svg/SVGLength.h:
140
        (WebCore::SVGLength::create):
141
        (WebCore::SVGLength::clone const):
142
        (WebCore::SVGLength::unitType):
143
        (WebCore::SVGLength::valueForBindings):
144
        (WebCore::SVGLength::setValueForBindings):
145
        (WebCore::SVGLength::valueInSpecifiedUnits):
146
        (WebCore::SVGLength::setValueInSpecifiedUnits):
147
        (WebCore::SVGLength::setValueAsString):
148
        (WebCore::SVGLength::newValueSpecifiedUnits):
149
        (WebCore::SVGLength::convertToSpecifiedUnits):
150
        (WebCore::SVGLength::valueAsString): Deleted.
151
        (WebCore::SVGLength::SVGLength): Deleted.
152
        * svg/SVGLengthList.h:
153
        (WebCore::SVGLengthList::create):
154
        (WebCore::SVGLengthList::lengthMode const):
155
        (WebCore::SVGLengthList::parse):
156
        (WebCore::SVGLengthList::SVGLengthList):
157
        * svg/SVGLengthListValues.cpp: Removed.
158
        * svg/SVGLengthListValues.h: Removed.
159
        * svg/SVGLineElement.cpp:
160
        (WebCore::SVGLineElement::SVGLineElement):
161
        (WebCore::SVGLineElement::parseAttribute):
162
        (WebCore::SVGLineElement::svgAttributeChanged):
163
        (WebCore::SVGLineElement::registerAttributes): Deleted.
164
        * svg/SVGLineElement.h:
165
        * svg/SVGLinearGradientElement.cpp:
166
        (WebCore::SVGLinearGradientElement::SVGLinearGradientElement):
167
        (WebCore::SVGLinearGradientElement::parseAttribute):
168
        (WebCore::SVGLinearGradientElement::svgAttributeChanged):
169
        (WebCore::SVGLinearGradientElement::registerAttributes): Deleted.
170
        * svg/SVGLinearGradientElement.h:
171
        * svg/SVGMarkerElement.cpp:
172
        (WebCore::SVGMarkerElement::SVGMarkerElement):
173
        (WebCore::SVGMarkerElement::registerAttributes):
174
        (WebCore::SVGMarkerElement::parseAttribute):
175
        * svg/SVGMarkerElement.h:
176
        * svg/SVGMaskElement.cpp:
177
        (WebCore::SVGMaskElement::SVGMaskElement):
178
        (WebCore::SVGMaskElement::registerAttributes):
179
        (WebCore::SVGMaskElement::parseAttribute):
180
        (WebCore::SVGMaskElement::svgAttributeChanged):
181
        * svg/SVGMaskElement.h:
182
        * svg/SVGPatternElement.cpp:
183
        (WebCore::SVGPatternElement::SVGPatternElement):
184
        (WebCore::SVGPatternElement::registerAttributes):
185
        (WebCore::SVGPatternElement::parseAttribute):
186
        * svg/SVGPatternElement.h:
187
        * svg/SVGPoint.h:
188
        * svg/SVGRadialGradientElement.cpp:
189
        (WebCore::SVGRadialGradientElement::SVGRadialGradientElement):
190
        (WebCore::SVGRadialGradientElement::parseAttribute):
191
        (WebCore::SVGRadialGradientElement::svgAttributeChanged):
192
        (WebCore::SVGRadialGradientElement::registerAttributes): Deleted.
193
        * svg/SVGRadialGradientElement.h:
194
        * svg/SVGRectElement.cpp:
195
        (WebCore::SVGRectElement::SVGRectElement):
196
        (WebCore::SVGRectElement::parseAttribute):
197
        (WebCore::SVGRectElement::svgAttributeChanged):
198
        (WebCore::SVGRectElement::registerAttributes): Deleted.
199
        * svg/SVGRectElement.h:
200
        * svg/SVGSVGElement.cpp:
201
        (WebCore::SVGSVGElement::SVGSVGElement):
202
        (WebCore::SVGSVGElement::parseAttribute):
203
        (WebCore::SVGSVGElement::svgAttributeChanged):
204
        (WebCore::SVGSVGElement::registerAttributes): Deleted.
205
        * svg/SVGSVGElement.h:
206
        * svg/SVGTextContentElement.cpp:
207
        (WebCore::SVGTextContentElement::SVGTextContentElement):
208
        (WebCore::SVGTextContentElement::registerAttributes):
209
        (WebCore::SVGTextContentElement::parseAttribute):
210
        (WebCore::SVGTextContentElement::svgAttributeChanged):
211
        (WebCore::SVGTextContentElement::textLengthAnimated):
212
        * svg/SVGTextContentElement.h:
213
        (WebCore::SVGTextContentElement::specifiedTextLength const):
214
        (WebCore::SVGTextContentElement::textLength const):
215
        (WebCore::SVGTextContentElement::specifiedTextLength): Deleted.
216
        (WebCore::SVGTextContentElement::textLengthAnimated): Deleted.
217
        (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::SVGAnimatedCustomLengthAttribute): Deleted.
218
        (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::synchronize): Deleted.
219
        (WebCore::SVGTextContentElement::SVGAnimatedCustomLengthAttribute::animatedProperty): Deleted.
220
        * svg/SVGTextPathElement.cpp:
221
        (WebCore::SVGTextPathElement::SVGTextPathElement):
222
        (WebCore::SVGTextPathElement::registerAttributes):
223
        (WebCore::SVGTextPathElement::parseAttribute):
224
        * svg/SVGTextPathElement.h:
225
        * svg/SVGTextPositioningElement.cpp:
226
        (WebCore::SVGTextPositioningElement::SVGTextPositioningElement):
227
        (WebCore::SVGTextPositioningElement::parseAttribute):
228
        (WebCore::SVGTextPositioningElement::svgAttributeChanged):
229
        (WebCore::SVGTextPositioningElement::registerAttributes): Deleted.
230
        * svg/SVGTextPositioningElement.h:
231
        (WebCore::SVGTextPositioningElement::x const):
232
        (WebCore::SVGTextPositioningElement::y const):
233
        (WebCore::SVGTextPositioningElement::dx const):
234
        (WebCore::SVGTextPositioningElement::dy const):
235
        (WebCore::SVGTextPositioningElement::xAnimated):
236
        (WebCore::SVGTextPositioningElement::yAnimated):
237
        (WebCore::SVGTextPositioningElement::dxAnimated):
238
        (WebCore::SVGTextPositioningElement::dyAnimated):
239
        (WebCore::SVGTextPositioningElement::isKnownAttribute): Deleted.
240
        * svg/SVGUseElement.cpp:
241
        (WebCore::SVGUseElement::SVGUseElement):
242
        (WebCore::SVGUseElement::parseAttribute):
243
        (WebCore::SVGUseElement::svgAttributeChanged):
244
        (WebCore::SVGUseElement::registerAttributes): Deleted.
245
        * svg/SVGUseElement.h:
246
        * svg/SVGValue.h:
247
        * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
248
        * svg/properties/SVGAnimatedPropertyAnimator.h:
249
        * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
250
        * svg/properties/SVGAnimatedPropertyImpl.h:
251
        * svg/properties/SVGAnimationAdditiveListFunctionImpl.h:
252
        (WebCore::SVGAnimationLengthListFunction::SVGAnimationLengthListFunction):
253
        (WebCore::SVGAnimationLengthListFunction::progress):
254
        (WebCore::SVGAnimationNumberListFunction::progress):
255
        (WebCore::SVGAnimationPointListFunction::progress):
256
        * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
257
        (WebCore::SVGAnimationLengthFunction::SVGAnimationLengthFunction):
258
        (WebCore::SVGAnimationLengthFunction::progress):
259
        * svg/properties/SVGAttributeAnimator.cpp:
260
        (WebCore::SVGAttributeAnimator::isAnimatedStylePropertyAniamtor const):
261
        * svg/properties/SVGAttributeAnimator.h:
262
        * svg/properties/SVGAttributeRegistry.h:
263
        * svg/properties/SVGPropertyAnimatorFactory.h:
264
        (WebCore::SVGPropertyAnimatorFactory::createLengthAnimator):
265
        (WebCore::SVGPropertyAnimatorFactory::createLengthListAnimator):
266
        (WebCore::SVGPropertyAnimatorFactory::attributeAnimatorCreator):
267
        * svg/properties/SVGPropertyOwnerRegistry.h:
268
        (WebCore::SVGPropertyOwnerRegistry::registerProperty):
269
        (WebCore::SVGPropertyOwnerRegistry::isAnimatedLengthAttribute):
270
        * svg/properties/SVGPropertyRegistry.h:
271
        * svg/properties/SVGValuePropertyAnimator.h: Added.
272
        (WebCore::SVGValuePropertyAnimator::SVGValuePropertyAnimator):
273
        * svg/properties/SVGValuePropertyAnimatorImpl.h: Added.
274
        * svg/properties/SVGValuePropertyListAnimator.h: Added.
275
        (WebCore::SVGValuePropertyListAnimator::SVGValuePropertyListAnimator):
276
        * svg/properties/SVGValuePropertyListAnimatorImpl.h: Added.
277
1
2019-03-26  Mike Gorse  <mgorse@alum.wpi.edu>
278
2019-03-26  Mike Gorse  <mgorse@alum.wpi.edu>
2
279
3
        Build failure with gstreamer 1.12.5 if USE_GSTREAMER_GL is enabled
280
        Build failure with gstreamer 1.12.5 if USE_GSTREAMER_GL is enabled
- a/Source/WebCore/Sources.txt -3 lines
Lines 2267-2274 svg/SVGAnimateElement.cpp a/Source/WebCore/Sources.txt_sec1
2267
svg/SVGAnimateElementBase.cpp
2267
svg/SVGAnimateElementBase.cpp
2268
svg/SVGAnimateMotionElement.cpp
2268
svg/SVGAnimateMotionElement.cpp
2269
svg/SVGAnimateTransformElement.cpp
2269
svg/SVGAnimateTransformElement.cpp
2270
svg/SVGAnimatedLength.cpp
2271
svg/SVGAnimatedLengthList.cpp
2272
svg/SVGAnimatedPath.cpp
2270
svg/SVGAnimatedPath.cpp
2273
svg/SVGAnimatedTransformList.cpp
2271
svg/SVGAnimatedTransformList.cpp
2274
svg/SVGAnimatedTypeAnimator.cpp
2272
svg/SVGAnimatedTypeAnimator.cpp
Lines 2334-2340 svg/SVGImageLoader.cpp a/Source/WebCore/Sources.txt_sec2
2334
svg/SVGLangSpace.cpp
2332
svg/SVGLangSpace.cpp
2335
svg/SVGLegacyAttributeAnimationController.cpp
2333
svg/SVGLegacyAttributeAnimationController.cpp
2336
svg/SVGLengthContext.cpp
2334
svg/SVGLengthContext.cpp
2337
svg/SVGLengthListValues.cpp
2338
svg/SVGLengthValue.cpp
2335
svg/SVGLengthValue.cpp
2339
svg/SVGLineElement.cpp
2336
svg/SVGLineElement.cpp
2340
svg/SVGLinearGradientElement.cpp
2337
svg/SVGLinearGradientElement.cpp
- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj -10 / +8 lines
Lines 271-278 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
271
		088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */; };
271
		088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */; };
272
		088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
272
		088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
273
		088C2F7A12390081003D65CE /* SVGTextLayoutAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 088C2F7612390080003D65CE /* SVGTextLayoutAttributes.h */; };
273
		088C2F7A12390081003D65CE /* SVGTextLayoutAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 088C2F7612390080003D65CE /* SVGTextLayoutAttributes.h */; };
274
		089021A9126EF5DE0092D5EA /* SVGAnimatedLength.h in Headers */ = {isa = PBXBuildFile; fileRef = 089021A8126EF5DE0092D5EA /* SVGAnimatedLength.h */; };
275
		089021AD126EF5E90092D5EA /* SVGAnimatedLengthList.h in Headers */ = {isa = PBXBuildFile; fileRef = 089021AC126EF5E90092D5EA /* SVGAnimatedLengthList.h */; };
276
		089582560E857A7E00F82C83 /* ImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 089582540E857A7E00F82C83 /* ImageLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
274
		089582560E857A7E00F82C83 /* ImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 089582540E857A7E00F82C83 /* ImageLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
277
		089A8E07128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */; };
275
		089A8E07128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */; };
278
		08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A484760E5272C500C3FE76 /* ScriptElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
276
		08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A484760E5272C500C3FE76 /* ScriptElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 2226-2232 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
2226
		7C30D9861F815AEC00268356 /* JSAbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C30D9811F815AC100268356 /* JSAbortSignal.h */; };
2224
		7C30D9861F815AEC00268356 /* JSAbortSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C30D9811F815AC100268356 /* JSAbortSignal.h */; };
2227
		7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
2225
		7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
2228
		7C330A081DF9F95100D3395C /* JSPositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A061DF9F95100D3395C /* JSPositionOptions.h */; };
2226
		7C330A081DF9F95100D3395C /* JSPositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A061DF9F95100D3395C /* JSPositionOptions.h */; };
2229
		7C39C3651DDA865200FEFB29 /* SVGLengthListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */; };
2230
		7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
2227
		7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
2231
		7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };
2228
		7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };
2232
		7C3B79721908757B00B47A2D /* UserMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3B79701908757B00B47A2D /* UserMessageHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
2229
		7C3B79721908757B00B47A2D /* UserMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3B79701908757B00B47A2D /* UserMessageHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 5639-5646 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
5639
		088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyTraits.h; sourceTree = "<group>"; };
5636
		088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyTraits.h; sourceTree = "<group>"; };
5640
		088C2F7512390080003D65CE /* SVGTextLayoutAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutAttributes.cpp; sourceTree = "<group>"; };
5637
		088C2F7512390080003D65CE /* SVGTextLayoutAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutAttributes.cpp; sourceTree = "<group>"; };
5641
		088C2F7612390080003D65CE /* SVGTextLayoutAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutAttributes.h; sourceTree = "<group>"; };
5638
		088C2F7612390080003D65CE /* SVGTextLayoutAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutAttributes.h; sourceTree = "<group>"; };
5642
		089021A8126EF5DE0092D5EA /* SVGAnimatedLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedLength.h; sourceTree = "<group>"; };
5643
		089021AC126EF5E90092D5EA /* SVGAnimatedLengthList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedLengthList.h; sourceTree = "<group>"; };
5644
		089582530E857A7E00F82C83 /* ImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageLoader.cpp; sourceTree = "<group>"; };
5639
		089582530E857A7E00F82C83 /* ImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageLoader.cpp; sourceTree = "<group>"; };
5645
		089582540E857A7E00F82C83 /* ImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageLoader.h; sourceTree = "<group>"; };
5640
		089582540E857A7E00F82C83 /* ImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageLoader.h; sourceTree = "<group>"; };
5646
		089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPathSegListPropertyTearOff.h; sourceTree = "<group>"; };
5641
		089A8E06128D8B3D00E7A534 /* SVGAnimatedPathSegListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPathSegListPropertyTearOff.h; sourceTree = "<group>"; };
Lines 7557-7563 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
7557
		427DA71B13735DFA007C57FB /* JSServiceWorkerInternals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerInternals.cpp; sourceTree = "<group>"; };
7552
		427DA71B13735DFA007C57FB /* JSServiceWorkerInternals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerInternals.cpp; sourceTree = "<group>"; };
7558
		427DA71C13735DFA007C57FB /* JSServiceWorkerInternals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSServiceWorkerInternals.h; sourceTree = "<group>"; };
7553
		427DA71C13735DFA007C57FB /* JSServiceWorkerInternals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSServiceWorkerInternals.h; sourceTree = "<group>"; };
7559
		43107BE118CC19DE00CC18E8 /* SelectorPseudoTypeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorPseudoTypeMap.h; sourceTree = "<group>"; };
7554
		43107BE118CC19DE00CC18E8 /* SelectorPseudoTypeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorPseudoTypeMap.h; sourceTree = "<group>"; };
7560
		431A2FD613B7707A007791E4 /* SVGAnimatedLengthList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedLengthList.cpp; sourceTree = "<group>"; };
7561
		432D3FE718A8658400D7DC03 /* SelectorCheckerTestFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorCheckerTestFunctions.h; sourceTree = "<group>"; };
7555
		432D3FE718A8658400D7DC03 /* SelectorCheckerTestFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorCheckerTestFunctions.h; sourceTree = "<group>"; };
7562
		4358E87A1360A2EE00E4748C /* JSSVGFEDropShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGFEDropShadowElement.cpp; sourceTree = "<group>"; };
7556
		4358E87A1360A2EE00E4748C /* JSSVGFEDropShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGFEDropShadowElement.cpp; sourceTree = "<group>"; };
7563
		4358E87B1360A2EE00E4748C /* JSSVGFEDropShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGFEDropShadowElement.h; sourceTree = "<group>"; };
7557
		4358E87B1360A2EE00E4748C /* JSSVGFEDropShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGFEDropShadowElement.h; sourceTree = "<group>"; };
Lines 7619-7625 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
7619
		436708B912D9CA4B00044234 /* SVGResourcesCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGResourcesCache.h; sourceTree = "<group>"; };
7613
		436708B912D9CA4B00044234 /* SVGResourcesCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGResourcesCache.h; sourceTree = "<group>"; };
7620
		436708BA12D9CA4B00044234 /* SVGResourcesCycleSolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGResourcesCycleSolver.cpp; sourceTree = "<group>"; };
7614
		436708BA12D9CA4B00044234 /* SVGResourcesCycleSolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGResourcesCycleSolver.cpp; sourceTree = "<group>"; };
7621
		436708BB12D9CA4B00044234 /* SVGResourcesCycleSolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGResourcesCycleSolver.h; sourceTree = "<group>"; };
7615
		436708BB12D9CA4B00044234 /* SVGResourcesCycleSolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGResourcesCycleSolver.h; sourceTree = "<group>"; };
7622
		4381763A13A697D4007D1187 /* SVGAnimatedLength.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedLength.cpp; sourceTree = "<group>"; };
7623
		439046C312DA25E800AF80A2 /* RenderMathMLBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLBlock.cpp; sourceTree = "<group>"; };
7616
		439046C312DA25E800AF80A2 /* RenderMathMLBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLBlock.cpp; sourceTree = "<group>"; };
7624
		439046C412DA25E800AF80A2 /* RenderMathMLBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLBlock.h; sourceTree = "<group>"; };
7617
		439046C412DA25E800AF80A2 /* RenderMathMLBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLBlock.h; sourceTree = "<group>"; };
7625
		439046C512DA25E800AF80A2 /* RenderMathMLFenced.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLFenced.cpp; sourceTree = "<group>"; };
7618
		439046C512DA25E800AF80A2 /* RenderMathMLFenced.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLFenced.cpp; sourceTree = "<group>"; };
Lines 9523-9528 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
9523
		72F1ADA11A3904C300014E18 /* EXTFragDepth.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTFragDepth.idl; sourceTree = "<group>"; };
9516
		72F1ADA11A3904C300014E18 /* EXTFragDepth.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTFragDepth.idl; sourceTree = "<group>"; };
9524
		72F1ADA31A390B9F00014E18 /* JSEXTFragDepth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTFragDepth.cpp; sourceTree = "<group>"; };
9517
		72F1ADA31A390B9F00014E18 /* JSEXTFragDepth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTFragDepth.cpp; sourceTree = "<group>"; };
9525
		72F1ADA41A390B9F00014E18 /* JSEXTFragDepth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTFragDepth.h; sourceTree = "<group>"; };
9518
		72F1ADA41A390B9F00014E18 /* JSEXTFragDepth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTFragDepth.h; sourceTree = "<group>"; };
9519
		72FB238422497AD4007E5AC7 /* SVGValuePropertyAnimatorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyAnimatorImpl.h; sourceTree = "<group>"; };
9520
		72FB238622497AD5007E5AC7 /* SVGValuePropertyAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyAnimator.h; sourceTree = "<group>"; };
9521
		72FB238722497B15007E5AC7 /* SVGValuePropertyListAnimatorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyListAnimatorImpl.h; sourceTree = "<group>"; };
9522
		72FB238822497B15007E5AC7 /* SVGValuePropertyListAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyListAnimator.h; sourceTree = "<group>"; };
9526
		7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineRecordFactory.h; sourceTree = "<group>"; };
9523
		7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineRecordFactory.h; sourceTree = "<group>"; };
9527
		7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineRecordFactory.cpp; sourceTree = "<group>"; };
9524
		7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineRecordFactory.cpp; sourceTree = "<group>"; };
9528
		75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MessageEvent.cpp; sourceTree = "<group>"; };
9525
		75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MessageEvent.cpp; sourceTree = "<group>"; };
Lines 16259-16265 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
16259
				088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */,
16256
				088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */,
16260
				088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */,
16257
				088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */,
16261
				721443462240CAD200F12FF7 /* SVGValueProperty.h */,
16258
				721443462240CAD200F12FF7 /* SVGValueProperty.h */,
16259
				72FB238622497AD5007E5AC7 /* SVGValuePropertyAnimator.h */,
16260
				72FB238422497AD4007E5AC7 /* SVGValuePropertyAnimatorImpl.h */,
16262
				7266F02522430F8C00833975 /* SVGValuePropertyList.h */,
16261
				7266F02522430F8C00833975 /* SVGValuePropertyList.h */,
16262
				72FB238822497B15007E5AC7 /* SVGValuePropertyListAnimator.h */,
16263
				72FB238722497B15007E5AC7 /* SVGValuePropertyListAnimatorImpl.h */,
16263
			);
16264
			);
16264
			path = properties;
16265
			path = properties;
16265
			sourceTree = "<group>";
16266
			sourceTree = "<group>";
Lines 24338-24345 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
24338
				7134496C146941B300720312 /* SVGLengthContext.h */,
24339
				7134496C146941B300720312 /* SVGLengthContext.h */,
24339
				B22278A00D00BF200071B782 /* SVGLengthList.h */,
24340
				B22278A00D00BF200071B782 /* SVGLengthList.h */,
24340
				B22278A10D00BF200071B782 /* SVGLengthList.idl */,
24341
				B22278A10D00BF200071B782 /* SVGLengthList.idl */,
24341
				7C39C3621DDA864900FEFB29 /* SVGLengthListValues.cpp */,
24342
				7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */,
24343
				7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */,
24342
				7CE58D521DD7B09300128552 /* SVGLengthValue.cpp */,
24344
				7CE58D531DD7B09300128552 /* SVGLengthValue.h */,
24343
				7CE58D531DD7B09300128552 /* SVGLengthValue.h */,
24345
				B22278A20D00BF200071B782 /* SVGLinearGradientElement.cpp */,
24344
				B22278A20D00BF200071B782 /* SVGLinearGradientElement.cpp */,
Lines 31988-31994 a/Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
31988
				55D70D23223B017C00044B8E /* SVGLegacyAnimatedProperty.h in Headers */,
31987
				55D70D23223B017C00044B8E /* SVGLegacyAnimatedProperty.h in Headers */,
31989
				7134496E146941B300720312 /* SVGLengthContext.h in Headers */,
31988
				7134496E146941B300720312 /* SVGLengthContext.h in Headers */,
31990
				B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */,
31989
				B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */,
31991
				7C39C3651DDA865200FEFB29 /* SVGLengthListValues.h in Headers */,
31992
				7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */,
31990
				7CCEBFC01DD8F6AB002C40B8 /* SVGLengthValue.h in Headers */,
31993
				B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */,
31991
				B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */,
31994
				B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */,
31992
				B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */,
- a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp -9 / +9 lines
Lines 160-175 void SVGTextLayoutAttributesBuilder::buildCharacterDataMap(RenderSVGText& textRo a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp_sec1
160
        fillCharacterDataMap(m_textPositions[i]);
160
        fillCharacterDataMap(m_textPositions[i]);
161
}
161
}
162
162
163
static inline void updateCharacterData(unsigned i, float& lastRotation, SVGCharacterData& data, const SVGLengthContext& lengthContext, const SVGLengthListValues* xList, const SVGLengthListValues* yList, const SVGLengthListValues* dxList, const SVGLengthListValues* dyList, const SVGNumberList* rotateList)
163
static inline void updateCharacterData(unsigned i, float& lastRotation, SVGCharacterData& data, const SVGLengthContext& lengthContext, const SVGLengthList* xList, const SVGLengthList* yList, const SVGLengthList* dxList, const SVGLengthList* dyList, const SVGNumberList* rotateList)
164
{
164
{
165
    if (xList)
165
    if (xList)
166
        data.x = xList->at(i).value(lengthContext);
166
        data.x = xList->items()[i]->value().value(lengthContext);
167
    if (yList)
167
    if (yList)
168
        data.y = yList->at(i).value(lengthContext);
168
        data.y = yList->items()[i]->value().value(lengthContext);
169
    if (dxList)
169
    if (dxList)
170
        data.dx = dxList->at(i).value(lengthContext);
170
        data.dx = dxList->items()[i]->value().value(lengthContext);
171
    if (dyList)
171
    if (dyList)
172
        data.dy = dyList->at(i).value(lengthContext);
172
        data.dy = dyList->items()[i]->value().value(lengthContext);
173
    if (rotateList) {
173
    if (rotateList) {
174
        data.rotate = rotateList->items()[i]->value();
174
        data.rotate = rotateList->items()[i]->value();
175
        lastRotation = data.rotate;
175
        lastRotation = data.rotate;
Lines 195-204 void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp_sec2
195
    float lastRotation = SVGTextLayoutAttributes::emptyValue();
195
    float lastRotation = SVGTextLayoutAttributes::emptyValue();
196
    SVGLengthContext lengthContext(position.element);
196
    SVGLengthContext lengthContext(position.element);
197
    for (unsigned i = 0; i < position.length; ++i) {
197
    for (unsigned i = 0; i < position.length; ++i) {
198
        const SVGLengthListValues* xListPtr = i < xListSize ? &xList : 0;
198
        const SVGLengthList* xListPtr = i < xListSize ? &xList : nullptr;
199
        const SVGLengthListValues* yListPtr = i < yListSize ? &yList : 0;
199
        const SVGLengthList* yListPtr = i < yListSize ? &yList : nullptr;
200
        const SVGLengthListValues* dxListPtr = i < dxListSize ? &dxList : 0;
200
        const SVGLengthList* dxListPtr = i < dxListSize ? &dxList : nullptr;
201
        const SVGLengthListValues* dyListPtr = i < dyListSize ? &dyList : 0;
201
        const SVGLengthList* dyListPtr = i < dyListSize ? &dyList : nullptr;
202
        const SVGNumberList* rotateListPtr = i < rotateListSize ? &rotateList : nullptr;
202
        const SVGNumberList* rotateListPtr = i < rotateListSize ? &rotateList : nullptr;
203
        if (!xListPtr && !yListPtr && !dxListPtr && !dyListPtr && !rotateListPtr)
203
        if (!xListPtr && !yListPtr && !dxListPtr && !dyListPtr && !rotateListPtr)
204
            break;
204
            break;
- a/Source/WebCore/svg/SVGAnimateElementBase.cpp -1 / +2 lines
Lines 25-30 a/Source/WebCore/svg/SVGAnimateElementBase.cpp_sec1
25
#include "SVGAnimateElementBase.h"
25
#include "SVGAnimateElementBase.h"
26
26
27
#include "QualifiedName.h"
27
#include "QualifiedName.h"
28
#include "SVGAnimatorFactory.h"
28
#include "SVGAttributeAnimationController.h"
29
#include "SVGAttributeAnimationController.h"
29
#include "SVGElement.h"
30
#include "SVGElement.h"
30
#include "SVGLegacyAttributeAnimationController.h"
31
#include "SVGLegacyAttributeAnimationController.h"
Lines 63-69 bool SVGAnimateElementBase::hasValidAttributeType() const a/Source/WebCore/svg/SVGAnimateElementBase.cpp_sec2
63
    if (!targetElement() || hasInvalidCSSAttributeType())
64
    if (!targetElement() || hasInvalidCSSAttributeType())
64
        return false;
65
        return false;
65
66
66
    if (determineAnimatedPropertyType(*targetElement()) != AnimatedUnknown)
67
    if (SVGAnimatorFactory::isSupportedAttributeType(determineAnimatedPropertyType(*targetElement())))
67
        return true;
68
        return true;
68
69
69
    return targetElement()->isAnimatedAttribute(attributeName());
70
    return targetElement()->isAnimatedAttribute(attributeName());
- a/Source/WebCore/svg/SVGAnimatedLength.cpp -116 lines
Lines 1-116 a/Source/WebCore/svg/SVGAnimatedLength.cpp_sec1
1
/*
2
 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 */
20
21
#include "config.h"
22
#include "SVGAnimatedLength.h"
23
24
#include "SVGAnimateElementBase.h"
25
26
namespace WebCore {
27
28
SVGAnimatedLengthAnimator::SVGAnimatedLengthAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
29
    : SVGAnimatedTypeAnimator(AnimatedLength, animationElement, contextElement)
30
    , m_lengthMode(SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()))
31
{
32
}
33
34
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
35
{
36
    return SVGAnimatedType::create(SVGLengthValue(m_lengthMode, string));
37
}
38
39
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
40
{
41
    return constructFromBaseValue<SVGAnimatedLength>(animatedTypes);
42
}
43
44
void SVGAnimatedLengthAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
45
{
46
    stopAnimValAnimationForType<SVGAnimatedLength>(animatedTypes);
47
}
48
49
void SVGAnimatedLengthAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
50
{
51
    resetFromBaseValue<SVGAnimatedLength>(animatedTypes, type);
52
}
53
54
void SVGAnimatedLengthAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
55
{
56
    animValWillChangeForType<SVGAnimatedLength>(animatedTypes);
57
}
58
59
void SVGAnimatedLengthAnimator::animValDidChange(const SVGElementAnimatedPropertyList& animatedTypes)
60
{
61
    animValDidChangeForType<SVGAnimatedLength>(animatedTypes);
62
}
63
64
void SVGAnimatedLengthAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
65
{
66
    ASSERT(from->type() == AnimatedLength);
67
    ASSERT(from->type() == to->type());
68
69
    SVGLengthContext lengthContext(m_contextElement);
70
    const auto& fromLength = from->as<SVGLengthValue>();
71
    auto& toLength = to->as<SVGLengthValue>();
72
73
    toLength.setValue(toLength.value(lengthContext) + fromLength.value(lengthContext), lengthContext);
74
}
75
76
static SVGLengthValue parseLengthFromString(SVGAnimationElement* animationElement, const String& string)
77
{
78
    SVGLengthValue length;
79
    length.setValueAsString(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()));
80
    return length;
81
}
82
83
void SVGAnimatedLengthAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
84
{
85
    ASSERT(m_animationElement);
86
    ASSERT(m_contextElement);
87
88
    auto fromSVGLength = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGLengthValue>();
89
    auto toSVGLength = to->as<SVGLengthValue>();
90
    const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->as<SVGLengthValue>();
91
    auto& animatedSVGLength = animated->as<SVGLengthValue>();
92
93
    // Apply CSS inheritance rules.
94
    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->fromPropertyValueType(), fromSVGLength, m_contextElement);
95
    m_animationElement->adjustForInheritance<SVGLengthValue>(parseLengthFromString, m_animationElement->toPropertyValueType(), toSVGLength, m_contextElement);
96
97
    SVGLengthContext lengthContext(m_contextElement);
98
    float animatedNumber = animatedSVGLength.value(lengthContext);
99
    SVGLengthType unitType = percentage < 0.5 ? fromSVGLength.unitType() : toSVGLength.unitType();
100
    m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromSVGLength.value(lengthContext), toSVGLength.value(lengthContext), toAtEndOfDurationSVGLength.value(lengthContext), animatedNumber);
101
102
    animatedSVGLength.setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
103
}
104
105
float SVGAnimatedLengthAnimator::calculateDistance(const String& fromString, const String& toString)
106
{
107
    ASSERT(m_animationElement);
108
    ASSERT(m_contextElement);
109
    auto lengthMode = SVGLengthValue::lengthModeForAnimatedLengthAttribute(m_animationElement->attributeName());
110
    auto from = SVGLengthValue(lengthMode, fromString);
111
    auto to = SVGLengthValue(lengthMode, toString);
112
    SVGLengthContext lengthContext(m_contextElement);
113
    return fabsf(to.value(lengthContext) - from.value(lengthContext));
114
}
115
116
}
- a/Source/WebCore/svg/SVGAnimatedLength.h -57 lines
Lines 1-57 a/Source/WebCore/svg/SVGAnimatedLength.h_sec1
1
/*
2
 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 */
20
21
#pragma once
22
23
#include "SVGAnimatedPropertyTearOff.h"
24
#include "SVGAnimatedTypeAnimator.h"
25
#include "SVGAttributeAccessor.h"
26
#include "SVGLength.h"
27
28
namespace WebCore {
29
30
class SVGAnimationElement;
31
32
using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGLength>;
33
using SVGAnimatedLengthAttribute = SVGAnimatedAttribute<SVGAnimatedLength>;
34
35
template<typename OwnerType>
36
using SVGAnimatedLengthAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthAttribute, AnimatedLength>;
37
38
class SVGAnimatedLengthAnimator final : public SVGAnimatedTypeAnimator {
39
public:
40
    SVGAnimatedLengthAnimator(SVGAnimationElement*, SVGElement*);
41
42
    std::unique_ptr<SVGAnimatedType> constructFromString(const String&) override;
43
    std::unique_ptr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
44
    void stopAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
45
    void resetAnimValToBaseVal(const SVGElementAnimatedPropertyList&, SVGAnimatedType&) override;
46
    void animValWillChange(const SVGElementAnimatedPropertyList&) override;
47
    void animValDidChange(const SVGElementAnimatedPropertyList&) override;
48
49
    void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) override;
50
    void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) override;
51
    float calculateDistance(const String& fromString, const String& toString) override;
52
53
private:
54
    SVGLengthMode m_lengthMode;
55
};
56
57
} // namespace WebCore
- a/Source/WebCore/svg/SVGAnimatedLengthList.cpp -131 lines
Lines 1-131 a/Source/WebCore/svg/SVGAnimatedLengthList.cpp_sec1
1
/*
2
 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "SVGAnimatedLengthList.h"
22
23
#include "SVGAnimateElementBase.h"
24
25
namespace WebCore {
26
27
SVGAnimatedLengthListAnimator::SVGAnimatedLengthListAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
28
    : SVGAnimatedTypeAnimator(AnimatedLengthList, animationElement, contextElement)
29
    , m_lengthMode(SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()))
30
{
31
}
32
33
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::constructFromString(const String& string)
34
{
35
    return SVGAnimatedType::create(SVGPropertyTraits<SVGLengthListValues>::fromString(string, m_lengthMode));
36
}
37
38
std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
39
{
40
    return constructFromBaseValue<SVGAnimatedLengthList>(animatedTypes);
41
}
42
43
void SVGAnimatedLengthListAnimator::stopAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)
44
{
45
    stopAnimValAnimationForType<SVGAnimatedLengthList>(animatedTypes);
46
}
47
48
void SVGAnimatedLengthListAnimator::resetAnimValToBaseVal(const SVGElementAnimatedPropertyList& animatedTypes, SVGAnimatedType& type)
49
{
50
    resetFromBaseValue<SVGAnimatedLengthList>(animatedTypes, type);
51
}
52
53
void SVGAnimatedLengthListAnimator::animValWillChange(const SVGElementAnimatedPropertyList& animatedTypes)
54
{
55
    animValWillChangeForType<SVGAnimatedLengthList>(animatedTypes);
56
}
57
58
void SVGAnimatedLengthListAnimator::animValDidChange(const SVGElementAnimatedPropertyList& animatedTypes)
59
{
60
    animValDidChangeForType<SVGAnimatedLengthList>(animatedTypes);
61
}
62
63
void SVGAnimatedLengthListAnimator::addAnimatedTypes(SVGAnimatedType* from, SVGAnimatedType* to)
64
{
65
    ASSERT(from->type() == AnimatedLengthList);
66
    ASSERT(from->type() == to->type());
67
68
    const auto& fromLengthList = from->as<SVGLengthListValues>();
69
    auto& toLengthList = to->as<SVGLengthListValues>();
70
71
    unsigned fromLengthListSize = fromLengthList.size();
72
    if (!fromLengthListSize || fromLengthListSize != toLengthList.size())
73
        return;
74
75
    SVGLengthContext lengthContext(m_contextElement);
76
    for (unsigned i = 0; i < fromLengthListSize; ++i)
77
        toLengthList[i].setValue(toLengthList[i].value(lengthContext) + fromLengthList[i].value(lengthContext), lengthContext);
78
}
79
80
static SVGLengthListValues parseLengthListFromString(SVGAnimationElement* animationElement, const String& string)
81
{
82
    SVGLengthListValues lengthList;
83
    lengthList.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(animationElement->attributeName()));
84
    return lengthList;
85
}
86
87
void SVGAnimatedLengthListAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
88
{
89
    ASSERT(m_animationElement);
90
    ASSERT(m_contextElement);
91
92
    auto fromLengthList = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGLengthListValues>();
93
    auto toLengthList = to->as<SVGLengthListValues>();
94
    const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->as<SVGLengthListValues>();
95
    auto& animatedLengthList = animated->as<SVGLengthListValues>();
96
97
    // Apply CSS inheritance rules.
98
    m_animationElement->adjustForInheritance<SVGLengthListValues>(parseLengthListFromString, m_animationElement->fromPropertyValueType(), fromLengthList, m_contextElement);
99
    m_animationElement->adjustForInheritance<SVGLengthListValues>(parseLengthListFromString, m_animationElement->toPropertyValueType(), toLengthList, m_contextElement);
100
101
    if (!m_animationElement->adjustFromToListValues<SVGLengthListValues>(fromLengthList, toLengthList, animatedLengthList, percentage))
102
        return;
103
104
    unsigned fromLengthListSize = fromLengthList.size();
105
    unsigned toLengthListSize = toLengthList.size();
106
    unsigned toAtEndOfDurationListSize = toAtEndOfDurationLengthList.size();
107
108
    SVGLengthContext lengthContext(m_contextElement);
109
    for (unsigned i = 0; i < toLengthListSize; ++i) {
110
        float animatedNumber = animatedLengthList[i].value(lengthContext);
111
        SVGLengthType unitType = toLengthList[i].unitType();
112
        float effectiveFrom = 0;
113
        if (fromLengthListSize) {
114
            if (percentage < 0.5)
115
                unitType = fromLengthList[i].unitType();
116
            effectiveFrom = fromLengthList[i].value(lengthContext);
117
        }
118
        float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationLengthList[i].value(lengthContext) : 0;
119
120
        m_animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, toLengthList[i].value(lengthContext), effectiveToAtEnd, animatedNumber);
121
        animatedLengthList[i].setValue(lengthContext, animatedNumber, m_lengthMode, unitType);
122
    }
123
}
124
125
float SVGAnimatedLengthListAnimator::calculateDistance(const String&, const String&)
126
{
127
    // FIXME: Distance calculation is not possible for SVGLengthListValues right now. We need the distance for every single value.
128
    return -1;
129
}
130
131
}
- a/Source/WebCore/svg/SVGAnimatedLengthList.h -58 lines
Lines 1-58 a/Source/WebCore/svg/SVGAnimatedLengthList.h_sec1
1
/*
2
 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 */
20
21
#pragma once
22
23
#include "SVGAnimatedListPropertyTearOff.h"
24
#include "SVGAnimatedTypeAnimator.h"
25
#include "SVGAttributeAccessor.h"
26
#include "SVGLength.h"
27
#include "SVGLengthList.h"
28
29
namespace WebCore {
30
31
class SVGAnimationElement;
32
33
using SVGAnimatedLengthList = SVGAnimatedListPropertyTearOff<SVGLengthListValues>;
34
using SVGAnimatedLengthListAttribute = SVGAnimatedAttributeList<SVGAnimatedLengthList>;
35
36
template<typename OwnerType>
37
using SVGAnimatedLengthListAttributeAccessor = SVGAnimatedAttributeAccessor<OwnerType, SVGAnimatedLengthListAttribute, AnimatedLengthList>;
38
39
class SVGAnimatedLengthListAnimator final : public SVGAnimatedTypeAnimator {
40
public:
41
    SVGAnimatedLengthListAnimator(SVGAnimationElement*, SVGElement*);
42
43
    std::unique_ptr<SVGAnimatedType> constructFromString(const String&) override;
44
    std::unique_ptr<SVGAnimatedType> startAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
45
    void stopAnimValAnimation(const SVGElementAnimatedPropertyList&) override;
46
    void resetAnimValToBaseVal(const SVGElementAnimatedPropertyList&, SVGAnimatedType&) override;
47
    void animValWillChange(const SVGElementAnimatedPropertyList&) override;
48
    void animValDidChange(const SVGElementAnimatedPropertyList&) override;
49
50
    void addAnimatedTypes(SVGAnimatedType*, SVGAnimatedType*) override;
51
    void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*, SVGAnimatedType*) override;
52
    float calculateDistance(const String& fromString, const String& toString) override;
53
54
private:
55
    SVGLengthMode m_lengthMode;
56
};
57
58
} // namespace WebCore
- a/Source/WebCore/svg/SVGAnimatedType.h -2 lines
Lines 81-88 public: a/Source/WebCore/svg/SVGAnimatedType.h_sec1
81
    AnimatedPropertyType type() const
81
    AnimatedPropertyType type() const
82
    {
82
    {
83
        static AnimatedPropertyType animatedTypes[] = {
83
        static AnimatedPropertyType animatedTypes[] = {
84
            AnimatedLength,
85
            AnimatedLengthList,
86
            AnimatedPath,
84
            AnimatedPath,
87
            AnimatedTransformList
85
            AnimatedTransformList
88
        };
86
        };
- a/Source/WebCore/svg/SVGAnimationElement.cpp -8 / +4 lines
Lines 336-348 bool SVGAnimationElement::isAccumulated() const a/Source/WebCore/svg/SVGAnimationElement.cpp_sec1
336
    return value == sum && animationMode() != AnimationMode::To;
336
    return value == sum && animationMode() != AnimationMode::To;
337
}
337
}
338
338
339
bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement* element, const QualifiedName& attributeName)
339
bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement* targetElement, const QualifiedName& attributeName)
340
{
340
{
341
    if (element->isTextContent()
341
    return targetElement->isAnimatedStyleAttribute(attributeName);
342
        && (attributeName == SVGNames::xAttr || attributeName == SVGNames::yAttr))
343
        return false;
344
345
    return SVGElement::isAnimatableCSSProperty(attributeName);
346
}
342
}
347
343
348
SVGAnimationElement::ShouldApplyAnimation SVGAnimationElement::shouldApplyAnimation(SVGElement* targetElement, const QualifiedName& attributeName)
344
SVGAnimationElement::ShouldApplyAnimation SVGAnimationElement::shouldApplyAnimation(SVGElement* targetElement, const QualifiedName& attributeName)
Lines 645-657 void SVGAnimationElement::adjustForInheritance(SVGElement* targetElement, const a/Source/WebCore/svg/SVGAnimationElement.cpp_sec2
645
    computeCSSPropertyValue(&svgParent, cssPropertyID(attributeName.localName()), value);
641
    computeCSSPropertyValue(&svgParent, cssPropertyID(attributeName.localName()), value);
646
}
642
}
647
643
648
static bool inheritsFromProperty(SVGElement*, const QualifiedName& attributeName, const String& value)
644
static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName& attributeName, const String& value)
649
{
645
{
650
    static NeverDestroyed<const AtomicString> inherit("inherit", AtomicString::ConstructFromLiteral);
646
    static NeverDestroyed<const AtomicString> inherit("inherit", AtomicString::ConstructFromLiteral);
651
    
647
    
652
    if (value.isEmpty() || value != inherit)
648
    if (value.isEmpty() || value != inherit)
653
        return false;
649
        return false;
654
    return SVGElement::isAnimatableCSSProperty(attributeName);
650
    return targetElement->isAnimatedStyleAttribute(attributeName);
655
}
651
}
656
652
657
void SVGAnimationElement::determinePropertyValueTypes(const String& from, const String& to)
653
void SVGAnimationElement::determinePropertyValueTypes(const String& from, const String& to)
- a/Source/WebCore/svg/SVGAnimatorFactory.h -9 / +31 lines
Lines 19-26 a/Source/WebCore/svg/SVGAnimatorFactory.h_sec1
19
19
20
#pragma once
20
#pragma once
21
21
22
#include "SVGAnimatedLength.h"
23
#include "SVGAnimatedLengthList.h"
24
#include "SVGAnimatedPath.h"
22
#include "SVGAnimatedPath.h"
25
#include "SVGAnimatedTransformList.h"
23
#include "SVGAnimatedTransformList.h"
26
24
Lines 30-35 class SVGAnimationElement; a/Source/WebCore/svg/SVGAnimatorFactory.h_sec2
30
28
31
class SVGAnimatorFactory {
29
class SVGAnimatorFactory {
32
public:
30
public:
31
    static bool isSupportedAttributeType(AnimatedPropertyType attributeType)
32
    {
33
        switch (attributeType) {
34
        case AnimatedAngle:
35
        case AnimatedBoolean:
36
        case AnimatedColor:
37
        case AnimatedEnumeration:
38
        case AnimatedInteger:
39
        case AnimatedIntegerOptionalInteger:
40
        case AnimatedLength:
41
        case AnimatedLengthList:
42
        case AnimatedNumber:
43
        case AnimatedNumberList:
44
        case AnimatedNumberOptionalNumber:
45
        case AnimatedPoints:
46
        case AnimatedPreserveAspectRatio:
47
        case AnimatedRect:
48
        case AnimatedString:
49
        case AnimatedUnknown:
50
            return false;
51
52
        case AnimatedPath:
53
        case AnimatedTransformList:
54
            return true;
55
        }
56
    }
57
33
    static std::unique_ptr<SVGAnimatedTypeAnimator> create(SVGAnimationElement* animationElement, SVGElement* contextElement, AnimatedPropertyType attributeType)
58
    static std::unique_ptr<SVGAnimatedTypeAnimator> create(SVGAnimationElement* animationElement, SVGElement* contextElement, AnimatedPropertyType attributeType)
34
    {
59
    {
35
        ASSERT(animationElement);
60
        ASSERT(animationElement);
Lines 42-47 public: a/Source/WebCore/svg/SVGAnimatorFactory.h_sec3
42
        case AnimatedEnumeration:
67
        case AnimatedEnumeration:
43
        case AnimatedInteger:
68
        case AnimatedInteger:
44
        case AnimatedIntegerOptionalInteger:
69
        case AnimatedIntegerOptionalInteger:
70
        case AnimatedLength:
71
        case AnimatedLengthList:
45
        case AnimatedNumber:
72
        case AnimatedNumber:
46
        case AnimatedNumberList:
73
        case AnimatedNumberList:
47
        case AnimatedNumberOptionalNumber:
74
        case AnimatedNumberOptionalNumber:
Lines 49-66 public: a/Source/WebCore/svg/SVGAnimatorFactory.h_sec4
49
        case AnimatedPreserveAspectRatio:
76
        case AnimatedPreserveAspectRatio:
50
        case AnimatedRect:
77
        case AnimatedRect:
51
        case AnimatedString:
78
        case AnimatedString:
52
            return nullptr;
79
        case AnimatedUnknown:
80
            break;
53
81
54
        case AnimatedLength:
55
            return std::make_unique<SVGAnimatedLengthAnimator>(animationElement, contextElement);
56
        case AnimatedLengthList:
57
            return std::make_unique<SVGAnimatedLengthListAnimator>(animationElement, contextElement);
58
        case AnimatedPath:
82
        case AnimatedPath:
59
            return std::make_unique<SVGAnimatedPathAnimator>(animationElement, contextElement);
83
            return std::make_unique<SVGAnimatedPathAnimator>(animationElement, contextElement);
60
        case AnimatedTransformList:
84
        case AnimatedTransformList:
61
            return std::make_unique<SVGAnimatedTransformListAnimator>(animationElement, contextElement);
85
            return std::make_unique<SVGAnimatedTransformListAnimator>(animationElement, contextElement);
62
        case AnimatedUnknown:
63
            break;
64
        }
86
        }
65
87
66
        ASSERT_NOT_REACHED();
88
        ASSERT_NOT_REACHED();
- a/Source/WebCore/svg/SVGCircleElement.cpp -16 / +12 lines
Lines 1-7 a/Source/WebCore/svg/SVGCircleElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 35-41 inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document a/Source/WebCore/svg/SVGCircleElement.cpp_sec2
35
    , SVGExternalResourcesRequired(this)
35
    , SVGExternalResourcesRequired(this)
36
{
36
{
37
    ASSERT(hasTagName(SVGNames::circleTag));
37
    ASSERT(hasTagName(SVGNames::circleTag));
38
    registerAttributes();
38
39
    static std::once_flag onceFlag;
40
    std::call_once(onceFlag, [] {
41
        PropertyRegistry::registerProperty<SVGNames::cxAttr, &SVGCircleElement::m_cx>();
42
        PropertyRegistry::registerProperty<SVGNames::cyAttr, &SVGCircleElement::m_cy>();
43
        PropertyRegistry::registerProperty<SVGNames::rAttr, &SVGCircleElement::m_r>();
44
    });
39
}
45
}
40
46
41
Ref<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagName, Document& document)
47
Ref<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagName, Document& document)
Lines 43-68 Ref<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagName, Doc a/Source/WebCore/svg/SVGCircleElement.cpp_sec3
43
    return adoptRef(*new SVGCircleElement(tagName, document));
49
    return adoptRef(*new SVGCircleElement(tagName, document));
44
}
50
}
45
51
46
void SVGCircleElement::registerAttributes()
47
{
48
    auto& registry = attributeRegistry();
49
    if (!registry.isEmpty())
50
        return;
51
    registry.registerAttribute<SVGNames::cxAttr, &SVGCircleElement::m_cx>();
52
    registry.registerAttribute<SVGNames::cyAttr, &SVGCircleElement::m_cy>();
53
    registry.registerAttribute<SVGNames::rAttr, &SVGCircleElement::m_r>();
54
}
55
56
void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
52
void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
57
{
53
{
58
    SVGParsingError parseError = NoError;
54
    SVGParsingError parseError = NoError;
59
55
60
    if (name == SVGNames::cxAttr)
56
    if (name == SVGNames::cxAttr)
61
        m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
57
        m_cx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
62
    else if (name == SVGNames::cyAttr)
58
    else if (name == SVGNames::cyAttr)
63
        m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
59
        m_cy->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
64
    else if (name == SVGNames::rAttr)
60
    else if (name == SVGNames::rAttr)
65
        m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
61
        m_r->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
66
62
67
    reportAttributeParsingError(parseError, name, value);
63
    reportAttributeParsingError(parseError, name, value);
68
64
Lines 72-78 void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr a/Source/WebCore/svg/SVGCircleElement.cpp_sec4
72
68
73
void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
69
void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
74
{
70
{
75
    if (isKnownAttribute(attrName)) {
71
    if (PropertyRegistry::isKnownAttribute(attrName)) {
76
        InstanceInvalidationGuard guard(*this);
72
        InstanceInvalidationGuard guard(*this);
77
        invalidateSVGPresentationAttributeStyle();
73
        invalidateSVGPresentationAttributeStyle();
78
        return;
74
        return;
- a/Source/WebCore/svg/SVGCircleElement.h -17 / +9 lines
Lines 21-27 a/Source/WebCore/svg/SVGCircleElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGExternalResourcesRequired.h"
24
#include "SVGExternalResourcesRequired.h"
26
#include "SVGGeometryElement.h"
25
#include "SVGGeometryElement.h"
27
#include "SVGNames.h"
26
#include "SVGNames.h"
Lines 33-62 class SVGCircleElement final : public SVGGeometryElement, public SVGExternalReso a/Source/WebCore/svg/SVGCircleElement.h_sec2
33
public:
32
public:
34
    static Ref<SVGCircleElement> create(const QualifiedName&, Document&);
33
    static Ref<SVGCircleElement> create(const QualifiedName&, Document&);
35
34
36
    const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); }
35
    const SVGLengthValue& cx() const { return m_cx->currentValue(); }
37
    const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); }
36
    const SVGLengthValue& cy() const { return m_cy->currentValue(); }
38
    const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); }
37
    const SVGLengthValue& r() const { return m_r->currentValue(); }
39
38
40
    RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); }
39
    SVGAnimatedLength& cxAnimated() { return m_cx; }
41
    RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); }
40
    SVGAnimatedLength& cyAnimated() { return m_cy; }
42
    RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); }
41
    SVGAnimatedLength& rAnimated() { return m_r; }
43
42
44
private:
43
private:
45
    SVGCircleElement(const QualifiedName&, Document&);
44
    SVGCircleElement(const QualifiedName&, Document&);
46
45
47
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>;
46
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>;
48
    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
49
    static void registerAttributes();
50
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
47
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
51
48
52
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>;
49
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGCircleElement, SVGGeometryElement, SVGExternalResourcesRequired>;
53
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
50
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
54
51
55
    static bool isKnownAttribute(const QualifiedName& attributeName)
56
    {
57
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
58
    }
59
60
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
52
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
61
    void svgAttributeChanged(const QualifiedName&) final;
53
    void svgAttributeChanged(const QualifiedName&) final;
62
54
Lines 67-75 private: a/Source/WebCore/svg/SVGCircleElement.h_sec3
67
59
68
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
60
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
69
    PropertyRegistry m_propertyRegistry { *this };
61
    PropertyRegistry m_propertyRegistry { *this };
70
    SVGAnimatedLengthAttribute m_cx { LengthModeWidth };
62
    Ref<SVGAnimatedLength> m_cx { SVGAnimatedLength::create(this, LengthModeWidth) };
71
    SVGAnimatedLengthAttribute m_cy { LengthModeHeight };
63
    Ref<SVGAnimatedLength> m_cy { SVGAnimatedLength::create(this, LengthModeHeight) };
72
    SVGAnimatedLengthAttribute m_r { LengthModeOther };
64
    Ref<SVGAnimatedLength> m_r { SVGAnimatedLength::create(this, LengthModeOther) };
73
};
65
};
74
66
75
} // namespace WebCore
67
} // namespace WebCore
- a/Source/WebCore/svg/SVGCursorElement.cpp -14 / +10 lines
Lines 1-7 a/Source/WebCore/svg/SVGCursorElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 40-46 inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document a/Source/WebCore/svg/SVGCursorElement.cpp_sec2
40
    , SVGURIReference(this)
40
    , SVGURIReference(this)
41
{
41
{
42
    ASSERT(hasTagName(SVGNames::cursorTag));
42
    ASSERT(hasTagName(SVGNames::cursorTag));
43
    registerAttributes();
43
44
    static std::once_flag onceFlag;
45
    std::call_once(onceFlag, [] {
46
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGCursorElement::m_x>();
47
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGCursorElement::m_y>();
48
    });
44
}
49
}
45
50
46
Ref<SVGCursorElement> SVGCursorElement::create(const QualifiedName& tagName, Document& document)
51
Ref<SVGCursorElement> SVGCursorElement::create(const QualifiedName& tagName, Document& document)
Lines 54-76 SVGCursorElement::~SVGCursorElement() a/Source/WebCore/svg/SVGCursorElement.cpp_sec3
54
        client->cursorElementRemoved(*this);
59
        client->cursorElementRemoved(*this);
55
}
60
}
56
61
57
void SVGCursorElement::registerAttributes()
58
{
59
    auto& registry = attributeRegistry();
60
    if (!registry.isEmpty())
61
        return;
62
    registry.registerAttribute<SVGNames::xAttr, &SVGCursorElement::m_x>();
63
    registry.registerAttribute<SVGNames::yAttr, &SVGCursorElement::m_y>();
64
}
65
66
void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
62
void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
67
{
63
{
68
    SVGParsingError parseError = NoError;
64
    SVGParsingError parseError = NoError;
69
65
70
    if (name == SVGNames::xAttr)
66
    if (name == SVGNames::xAttr)
71
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
67
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
72
    else if (name == SVGNames::yAttr)
68
    else if (name == SVGNames::yAttr)
73
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
69
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
74
70
75
    reportAttributeParsingError(parseError, name, value);
71
    reportAttributeParsingError(parseError, name, value);
76
72
Lines 92-98 void SVGCursorElement::removeClient(CSSCursorImageValue& value) a/Source/WebCore/svg/SVGCursorElement.cpp_sec4
92
88
93
void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName)
89
void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName)
94
{
90
{
95
    if (isKnownAttribute(attrName)) {
91
    if (PropertyRegistry::isKnownAttribute(attrName)) {
96
        InstanceInvalidationGuard guard(*this);
92
        InstanceInvalidationGuard guard(*this);
97
        for (auto& client : m_clients)
93
        for (auto& client : m_clients)
98
            client->cursorElementChanged(*this);
94
            client->cursorElementChanged(*this);
- a/Source/WebCore/svg/SVGCursorElement.h -14 / +6 lines
Lines 21-27 a/Source/WebCore/svg/SVGCursorElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGElement.h"
24
#include "SVGElement.h"
26
#include "SVGExternalResourcesRequired.h"
25
#include "SVGExternalResourcesRequired.h"
27
#include "SVGTests.h"
26
#include "SVGTests.h"
Lines 41-68 public: a/Source/WebCore/svg/SVGCursorElement.h_sec2
41
    void addClient(CSSCursorImageValue&);
40
    void addClient(CSSCursorImageValue&);
42
    void removeClient(CSSCursorImageValue&);
41
    void removeClient(CSSCursorImageValue&);
43
42
44
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
43
    const SVGLengthValue& x() const { return m_x->currentValue(); }
45
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
44
    const SVGLengthValue& y() const { return m_y->currentValue(); }
46
45
47
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
46
    SVGAnimatedLength& xAnimated() { return m_x; }
48
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
47
    SVGAnimatedLength& yAnimated() { return m_y; }
49
48
50
private:
49
private:
51
    SVGCursorElement(const QualifiedName&, Document&);
50
    SVGCursorElement(const QualifiedName&, Document&);
52
51
53
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>;
52
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>;
54
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
55
    static void registerAttributes();
56
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
53
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
57
54
58
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>;
55
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGCursorElement, SVGElement, SVGExternalResourcesRequired, SVGTests, SVGURIReference>;
59
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
56
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
60
    
57
    
61
    static bool isKnownAttribute(const QualifiedName& attributeName)
62
    {
63
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
64
    }
65
66
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
58
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
67
    void svgAttributeChanged(const QualifiedName&) final;
59
    void svgAttributeChanged(const QualifiedName&) final;
68
60
Lines 73-80 private: a/Source/WebCore/svg/SVGCursorElement.h_sec3
73
65
74
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
66
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
75
    PropertyRegistry m_propertyRegistry { *this };
67
    PropertyRegistry m_propertyRegistry { *this };
76
    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
68
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) };
77
    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
69
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) };
78
    HashSet<CSSCursorImageValue*> m_clients;
70
    HashSet<CSSCursorImageValue*> m_clients;
79
};
71
};
80
72
- a/Source/WebCore/svg/SVGElement.cpp +5 lines
Lines 762-767 bool SVGElement::isAnimatedAttribute(const QualifiedName& attributeName) const a/Source/WebCore/svg/SVGElement.cpp_sec1
762
    return SVGPropertyAnimatorFactory::isKnownAttribute(attributeName) || isAnimatedPropertyAttribute(attributeName);
762
    return SVGPropertyAnimatorFactory::isKnownAttribute(attributeName) || isAnimatedPropertyAttribute(attributeName);
763
}
763
}
764
764
765
bool SVGElement::isAnimatedStyleAttribute(const QualifiedName& attributeName) const
766
{
767
    return SVGPropertyAnimatorFactory::isKnownAttribute(attributeName) || propertyRegistry().isAnimatedStylePropertyAttribute(attributeName);
768
}
769
765
std::unique_ptr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
770
std::unique_ptr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
766
{
771
{
767
    // Property animator, e.g. "fill" or "fill-opacity".
772
    // Property animator, e.g. "fill" or "fill-opacity".
- a/Source/WebCore/svg/SVGElement.h +1 lines
Lines 156-161 public: a/Source/WebCore/svg/SVGElement.h_sec1
156
156
157
    bool isAnimatedPropertyAttribute(const QualifiedName&) const;
157
    bool isAnimatedPropertyAttribute(const QualifiedName&) const;
158
    bool isAnimatedAttribute(const QualifiedName&) const;
158
    bool isAnimatedAttribute(const QualifiedName&) const;
159
    bool isAnimatedStyleAttribute(const QualifiedName&) const;
159
160
160
    void commitPropertyChange(SVGProperty*) override;
161
    void commitPropertyChange(SVGProperty*) override;
161
    void commitPropertyChange(SVGAnimatedProperty&);
162
    void commitPropertyChange(SVGAnimatedProperty&);
- a/Source/WebCore/svg/SVGEllipseElement.cpp -18 / +14 lines
Lines 1-7 a/Source/WebCore/svg/SVGEllipseElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 35-41 inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Docume a/Source/WebCore/svg/SVGEllipseElement.cpp_sec2
35
    , SVGExternalResourcesRequired(this)
35
    , SVGExternalResourcesRequired(this)
36
{
36
{
37
    ASSERT(hasTagName(SVGNames::ellipseTag));
37
    ASSERT(hasTagName(SVGNames::ellipseTag));
38
    registerAttributes();
38
39
    static std::once_flag onceFlag;
40
    std::call_once(onceFlag, [] {
41
        PropertyRegistry::registerProperty<SVGNames::cxAttr, &SVGEllipseElement::m_cx>();
42
        PropertyRegistry::registerProperty<SVGNames::cyAttr, &SVGEllipseElement::m_cy>();
43
        PropertyRegistry::registerProperty<SVGNames::rxAttr, &SVGEllipseElement::m_rx>();
44
        PropertyRegistry::registerProperty<SVGNames::ryAttr, &SVGEllipseElement::m_ry>();
45
    });
39
}    
46
}    
40
47
41
Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, Document& document)
48
Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, Document& document)
Lines 43-71 Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, D a/Source/WebCore/svg/SVGEllipseElement.cpp_sec3
43
    return adoptRef(*new SVGEllipseElement(tagName, document));
50
    return adoptRef(*new SVGEllipseElement(tagName, document));
44
}
51
}
45
52
46
void SVGEllipseElement::registerAttributes()
47
{
48
    auto& registry = attributeRegistry();
49
    if (!registry.isEmpty())
50
        return;
51
    registry.registerAttribute<SVGNames::cxAttr, &SVGEllipseElement::m_cx>();
52
    registry.registerAttribute<SVGNames::cyAttr, &SVGEllipseElement::m_cy>();
53
    registry.registerAttribute<SVGNames::rxAttr, &SVGEllipseElement::m_rx>();
54
    registry.registerAttribute<SVGNames::ryAttr, &SVGEllipseElement::m_ry>();
55
}
56
57
void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
53
void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
58
{
54
{
59
    SVGParsingError parseError = NoError;
55
    SVGParsingError parseError = NoError;
60
56
61
    if (name == SVGNames::cxAttr)
57
    if (name == SVGNames::cxAttr)
62
        m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
58
        m_cx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
63
    else if (name == SVGNames::cyAttr)
59
    else if (name == SVGNames::cyAttr)
64
        m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
60
        m_cy->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
65
    else if (name == SVGNames::rxAttr)
61
    else if (name == SVGNames::rxAttr)
66
        m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
62
        m_rx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
67
    else if (name == SVGNames::ryAttr)
63
    else if (name == SVGNames::ryAttr)
68
        m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
64
        m_ry->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
69
65
70
    reportAttributeParsingError(parseError, name, value);
66
    reportAttributeParsingError(parseError, name, value);
71
67
Lines 75-81 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt a/Source/WebCore/svg/SVGEllipseElement.cpp_sec4
75
71
76
void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
72
void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
77
{
73
{
78
    if (isKnownAttribute(attrName)) {
74
    if (PropertyRegistry::isKnownAttribute(attrName)) {
79
        InstanceInvalidationGuard guard(*this);
75
        InstanceInvalidationGuard guard(*this);
80
        invalidateSVGPresentationAttributeStyle();
76
        invalidateSVGPresentationAttributeStyle();
81
        return;
77
        return;
- a/Source/WebCore/svg/SVGEllipseElement.h -20 / +12 lines
Lines 21-27 a/Source/WebCore/svg/SVGEllipseElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGExternalResourcesRequired.h"
24
#include "SVGExternalResourcesRequired.h"
26
#include "SVGGeometryElement.h"
25
#include "SVGGeometryElement.h"
27
#include "SVGNames.h"
26
#include "SVGNames.h"
Lines 33-64 class SVGEllipseElement final : public SVGGeometryElement, public SVGExternalRes a/Source/WebCore/svg/SVGEllipseElement.h_sec2
33
public:
32
public:
34
    static Ref<SVGEllipseElement> create(const QualifiedName&, Document&);
33
    static Ref<SVGEllipseElement> create(const QualifiedName&, Document&);
35
34
36
    const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); }
35
    const SVGLengthValue& cx() const { return m_cx->currentValue(); }
37
    const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); }
36
    const SVGLengthValue& cy() const { return m_cy->currentValue(); }
38
    const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); }
37
    const SVGLengthValue& rx() const { return m_rx->currentValue(); }
39
    const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); }
38
    const SVGLengthValue& ry() const { return m_ry->currentValue(); }
40
39
41
    RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); }
40
    SVGAnimatedLength& cxAnimated() { return m_cx; }
42
    RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); }
41
    SVGAnimatedLength& cyAnimated() { return m_cy; }
43
    RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); }
42
    SVGAnimatedLength& rxAnimated() { return m_rx; }
44
    RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); }
43
    SVGAnimatedLength& ryAnimated() { return m_ry; }
45
44
46
private:
45
private:
47
    SVGEllipseElement(const QualifiedName&, Document&);
46
    SVGEllipseElement(const QualifiedName&, Document&);
48
47
49
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>;
48
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>;
50
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
51
    static void registerAttributes();
52
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
49
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
53
    
50
    
54
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>;
51
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGEllipseElement, SVGGeometryElement, SVGExternalResourcesRequired>;
55
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
52
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
56
53
57
    static bool isKnownAttribute(const QualifiedName& attributeName)
58
    {
59
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
60
    }
61
62
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
54
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
63
    void svgAttributeChanged(const QualifiedName&) final;
55
    void svgAttributeChanged(const QualifiedName&) final;
64
56
Lines 69-78 private: a/Source/WebCore/svg/SVGEllipseElement.h_sec3
69
61
70
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
62
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
71
    PropertyRegistry m_propertyRegistry { *this };
63
    PropertyRegistry m_propertyRegistry { *this };
72
    SVGAnimatedLengthAttribute m_cx { LengthModeWidth };
64
    Ref<SVGAnimatedLength> m_cx { SVGAnimatedLength::create(this, LengthModeWidth) };
73
    SVGAnimatedLengthAttribute m_cy { LengthModeHeight };
65
    Ref<SVGAnimatedLength> m_cy { SVGAnimatedLength::create(this, LengthModeHeight) };
74
    SVGAnimatedLengthAttribute m_rx { LengthModeWidth };
66
    Ref<SVGAnimatedLength> m_rx { SVGAnimatedLength::create(this, LengthModeWidth) };
75
    SVGAnimatedLengthAttribute m_ry { LengthModeHeight };
67
    Ref<SVGAnimatedLength> m_ry { SVGAnimatedLength::create(this, LengthModeHeight) };
76
};
68
};
77
69
78
} // namespace WebCore
70
} // namespace WebCore
- a/Source/WebCore/svg/SVGFilterElement.cpp -18 / +10 lines
Lines 46-57 inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document a/Source/WebCore/svg/SVGFilterElement.cpp_sec1
46
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
46
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
47
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
47
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
48
    ASSERT(hasTagName(SVGNames::filterTag));
48
    ASSERT(hasTagName(SVGNames::filterTag));
49
    registerAttributes();
50
49
51
    static std::once_flag onceFlag;
50
    static std::once_flag onceFlag;
52
    std::call_once(onceFlag, [] {
51
    std::call_once(onceFlag, [] {
53
        PropertyRegistry::registerProperty<SVGNames::filterUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_filterUnits>();
52
        PropertyRegistry::registerProperty<SVGNames::filterUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_filterUnits>();
54
        PropertyRegistry::registerProperty<SVGNames::primitiveUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_primitiveUnits>();
53
        PropertyRegistry::registerProperty<SVGNames::primitiveUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGFilterElement::m_primitiveUnits>();
54
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGFilterElement::m_x>();
55
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGFilterElement::m_y>();
56
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGFilterElement::m_width>();
57
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGFilterElement::m_height>();
55
    });
58
    });
56
}
59
}
57
60
Lines 60-76 Ref<SVGFilterElement> SVGFilterElement::create(const QualifiedName& tagName, Doc a/Source/WebCore/svg/SVGFilterElement.cpp_sec2
60
    return adoptRef(*new SVGFilterElement(tagName, document));
63
    return adoptRef(*new SVGFilterElement(tagName, document));
61
}
64
}
62
65
63
void SVGFilterElement::registerAttributes()
64
{
65
    auto& registry = attributeRegistry();
66
    if (!registry.isEmpty())
67
        return;
68
    registry.registerAttribute<SVGNames::xAttr, &SVGFilterElement::m_x>();
69
    registry.registerAttribute<SVGNames::yAttr, &SVGFilterElement::m_y>();
70
    registry.registerAttribute<SVGNames::widthAttr, &SVGFilterElement::m_width>();
71
    registry.registerAttribute<SVGNames::heightAttr, &SVGFilterElement::m_height>();
72
}
73
74
void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
66
void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
75
{
67
{
76
    SVGParsingError parseError = NoError;
68
    SVGParsingError parseError = NoError;
Lines 84-96 void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr a/Source/WebCore/svg/SVGFilterElement.cpp_sec3
84
        if (propertyValue > 0)
76
        if (propertyValue > 0)
85
            m_primitiveUnits->setBaseValInternal<SVGUnitTypes::SVGUnitType>(propertyValue);
77
            m_primitiveUnits->setBaseValInternal<SVGUnitTypes::SVGUnitType>(propertyValue);
86
    } else if (name == SVGNames::xAttr)
78
    } else if (name == SVGNames::xAttr)
87
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
79
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
88
    else if (name == SVGNames::yAttr)
80
    else if (name == SVGNames::yAttr)
89
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
81
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
90
    else if (name == SVGNames::widthAttr)
82
    else if (name == SVGNames::widthAttr)
91
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
83
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
92
    else if (name == SVGNames::heightAttr)
84
    else if (name == SVGNames::heightAttr)
93
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
85
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
94
86
95
    reportAttributeParsingError(parseError, name, value);
87
    reportAttributeParsingError(parseError, name, value);
96
88
Lines 101-113 void SVGFilterElement::parseAttribute(const QualifiedName& name, const AtomicStr a/Source/WebCore/svg/SVGFilterElement.cpp_sec4
101
93
102
void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName)
94
void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName)
103
{
95
{
104
    if (isAnimatedLengthAttribute(attrName)) {
96
    if (PropertyRegistry::isAnimatedLengthAttribute(attrName)) {
105
        InstanceInvalidationGuard guard(*this);
97
        InstanceInvalidationGuard guard(*this);
106
        invalidateSVGPresentationAttributeStyle();
98
        invalidateSVGPresentationAttributeStyle();
107
        return;
99
        return;
108
    }
100
    }
109
101
110
    if (isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
102
    if (PropertyRegistry::isKnownAttribute(attrName) || SVGURIReference::isKnownAttribute(attrName)) {
111
        if (auto* renderer = this->renderer())
103
        if (auto* renderer = this->renderer())
112
            renderer->setNeedsLayout();
104
            renderer->setNeedsLayout();
113
        return;
105
        return;
- a/Source/WebCore/svg/SVGFilterElement.h -22 / +12 lines
Lines 23-29 a/Source/WebCore/svg/SVGFilterElement.h_sec1
23
23
24
#pragma once
24
#pragma once
25
25
26
#include "SVGAnimatedLength.h"
27
#include "SVGElement.h"
26
#include "SVGElement.h"
28
#include "SVGExternalResourcesRequired.h"
27
#include "SVGExternalResourcesRequired.h"
29
#include "SVGURIReference.h"
28
#include "SVGURIReference.h"
Lines 38-73 public: a/Source/WebCore/svg/SVGFilterElement.h_sec2
38
37
39
    SVGUnitTypes::SVGUnitType filterUnits() const { return m_filterUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
38
    SVGUnitTypes::SVGUnitType filterUnits() const { return m_filterUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
40
    SVGUnitTypes::SVGUnitType primitiveUnits() const { return m_primitiveUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
39
    SVGUnitTypes::SVGUnitType primitiveUnits() const { return m_primitiveUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
41
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
40
    const SVGLengthValue& x() const { return m_x->currentValue(); }
42
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
41
    const SVGLengthValue& y() const { return m_y->currentValue(); }
43
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
42
    const SVGLengthValue& width() const { return m_width->currentValue(); }
44
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
43
    const SVGLengthValue& height() const { return m_height->currentValue(); }
45
44
46
    SVGAnimatedEnumeration& filterUnitsAnimated() { return m_filterUnits; }
45
    SVGAnimatedEnumeration& filterUnitsAnimated() { return m_filterUnits; }
47
    SVGAnimatedEnumeration& primitiveUnitsAnimated() { return m_primitiveUnits; }
46
    SVGAnimatedEnumeration& primitiveUnitsAnimated() { return m_primitiveUnits; }
48
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
47
    SVGAnimatedLength& xAnimated() { return m_x; }
49
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
48
    SVGAnimatedLength& yAnimated() { return m_y; }
50
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
49
    SVGAnimatedLength& widthAnimated() { return m_width; }
51
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
50
    SVGAnimatedLength& heightAnimated() { return m_height; }
52
51
53
private:
52
private:
54
    SVGFilterElement(const QualifiedName&, Document&);
53
    SVGFilterElement(const QualifiedName&, Document&);
55
54
56
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
55
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFilterElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
57
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
58
    static void registerAttributes();
59
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
56
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
60
57
61
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFilterElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
58
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFilterElement, SVGElement, SVGExternalResourcesRequired, SVGURIReference>;
62
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
59
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
63
60
64
    static bool isKnownAttribute(const QualifiedName& attributeName)
65
    {
66
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
67
    }
68
69
    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
70
71
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
61
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
72
    void svgAttributeChanged(const QualifiedName&) final;
62
    void svgAttributeChanged(const QualifiedName&) final;
73
    void childrenChanged(const ChildChange&) final;
63
    void childrenChanged(const ChildChange&) final;
Lines 83-92 private: a/Source/WebCore/svg/SVGFilterElement.h_sec3
83
    PropertyRegistry m_propertyRegistry { *this };
73
    PropertyRegistry m_propertyRegistry { *this };
84
    Ref<SVGAnimatedEnumeration> m_filterUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) };
74
    Ref<SVGAnimatedEnumeration> m_filterUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) };
85
    Ref<SVGAnimatedEnumeration> m_primitiveUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) };
75
    Ref<SVGAnimatedEnumeration> m_primitiveUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) };
86
    SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" };
76
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth, "-10%") };
87
    SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" };
77
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight, "-10%") };
88
    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" };
78
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth, "120%") };
89
    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" };
79
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight, "120%") };
90
};
80
};
91
81
92
} // namespace WebCore
82
} // namespace WebCore
- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp -18 / +9 lines
Lines 2-8 a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp_sec1
2
 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4
 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
5
 * Copyright (C) 2018 Apple Inc. All rights reserved.
5
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
6
 *
6
 *
7
 * This library is free software; you can redistribute it and/or
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Library General Public
8
 * modify it under the terms of the GNU Library General Public
Lines 36-72 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGFilterPrimitiveStandardAttributes); a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp_sec2
36
SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document)
36
SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document& document)
37
    : SVGElement(tagName, document)
37
    : SVGElement(tagName, document)
38
{
38
{
39
    registerAttributes();
40
41
    static std::once_flag onceFlag;
39
    static std::once_flag onceFlag;
42
    std::call_once(onceFlag, [] {
40
    std::call_once(onceFlag, [] {
41
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGFilterPrimitiveStandardAttributes::m_x>();
42
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGFilterPrimitiveStandardAttributes::m_y>();
43
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGFilterPrimitiveStandardAttributes::m_width>();
44
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGFilterPrimitiveStandardAttributes::m_height>();
43
        PropertyRegistry::registerProperty<SVGNames::resultAttr, &SVGFilterPrimitiveStandardAttributes::m_result>();
45
        PropertyRegistry::registerProperty<SVGNames::resultAttr, &SVGFilterPrimitiveStandardAttributes::m_result>();
44
    });
46
    });
45
}
47
}
46
48
47
void SVGFilterPrimitiveStandardAttributes::registerAttributes()
48
{
49
    auto& registry = attributeRegistry();
50
    if (!registry.isEmpty())
51
        return;
52
    registry.registerAttribute<SVGNames::xAttr, &SVGFilterPrimitiveStandardAttributes::m_x>();
53
    registry.registerAttribute<SVGNames::yAttr, &SVGFilterPrimitiveStandardAttributes::m_y>();
54
    registry.registerAttribute<SVGNames::widthAttr, &SVGFilterPrimitiveStandardAttributes::m_width>();
55
    registry.registerAttribute<SVGNames::heightAttr, &SVGFilterPrimitiveStandardAttributes::m_height>();
56
}
57
58
void SVGFilterPrimitiveStandardAttributes::parseAttribute(const QualifiedName& name, const AtomicString& value)
49
void SVGFilterPrimitiveStandardAttributes::parseAttribute(const QualifiedName& name, const AtomicString& value)
59
{
50
{
60
    SVGParsingError parseError = NoError;
51
    SVGParsingError parseError = NoError;
61
52
62
    if (name == SVGNames::xAttr)
53
    if (name == SVGNames::xAttr)
63
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
54
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
64
    else if (name == SVGNames::yAttr)
55
    else if (name == SVGNames::yAttr)
65
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
56
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
66
    else if (name == SVGNames::widthAttr)
57
    else if (name == SVGNames::widthAttr)
67
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
58
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
68
    else if (name == SVGNames::heightAttr)
59
    else if (name == SVGNames::heightAttr)
69
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
60
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
70
    else if (name == SVGNames::resultAttr)
61
    else if (name == SVGNames::resultAttr)
71
        m_result->setBaseValInternal(value);
62
        m_result->setBaseValInternal(value);
72
63
- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h -20 / +12 lines
Lines 23-29 a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h_sec1
23
23
24
#include "RenderSVGResourceFilter.h"
24
#include "RenderSVGResourceFilter.h"
25
#include "RenderSVGResourceFilterPrimitive.h"
25
#include "RenderSVGResourceFilterPrimitive.h"
26
#include "SVGAnimatedLength.h"
27
#include "SVGElement.h"
26
#include "SVGElement.h"
28
#include "SVGNames.h"
27
#include "SVGNames.h"
29
#include <wtf/RefPtr.h>
28
#include <wtf/RefPtr.h>
Lines 48-63 public: a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h_sec2
48
47
49
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFilterPrimitiveStandardAttributes, SVGElement>;
48
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFilterPrimitiveStandardAttributes, SVGElement>;
50
49
51
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
50
    const SVGLengthValue& x() const { return m_x->currentValue(); }
52
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
51
    const SVGLengthValue& y() const { return m_y->currentValue(); }
53
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
52
    const SVGLengthValue& width() const { return m_width->currentValue(); }
54
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
53
    const SVGLengthValue& height() const { return m_height->currentValue(); }
55
    String result() const { return m_result->currentValue(); }
54
    String result() const { return m_result->currentValue(); }
56
55
57
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
56
    SVGAnimatedLength& xAnimated() { return m_x; }
58
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
57
    SVGAnimatedLength& yAnimated() { return m_y; }
59
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
58
    SVGAnimatedLength& widthAnimated() { return m_width; }
60
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
59
    SVGAnimatedLength& heightAnimated() { return m_height; }
61
    SVGAnimatedString& resultAnimated() { return m_result; }
60
    SVGAnimatedString& resultAnimated() { return m_result; }
62
61
63
protected:
62
protected:
Lines 71-86 protected: a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h_sec3
71
    void primitiveAttributeChanged(const QualifiedName& attributeName);
70
    void primitiveAttributeChanged(const QualifiedName& attributeName);
72
71
73
private:
72
private:
74
    static void registerAttributes();
75
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
73
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
76
77
    const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; }
74
    const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; }
78
75
79
    static bool isKnownAttribute(const QualifiedName& attributeName)
80
    {
81
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
82
    }
83
84
    bool isFilterEffect() const override { return true; }
76
    bool isFilterEffect() const override { return true; }
85
77
86
    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
78
    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
Lines 91-100 private: a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h_sec4
91
    PropertyRegistry m_propertyRegistry { *this };
83
    PropertyRegistry m_propertyRegistry { *this };
92
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified.
84
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "0%" were specified.
93
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified.
85
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "100%" were specified.
94
    SVGAnimatedLengthAttribute m_x { LengthModeWidth, "0%" };
86
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth, "0%") };
95
    SVGAnimatedLengthAttribute m_y { LengthModeHeight, "0%" };
87
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight, "0%") };
96
    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%" };
88
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth, "100%") };
97
    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%" };
89
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight, "100%") };
98
    Ref<SVGAnimatedString> m_result { SVGAnimatedString::create(this) };
90
    Ref<SVGAnimatedString> m_result { SVGAnimatedString::create(this) };
99
};
91
};
100
92
- a/Source/WebCore/svg/SVGForeignObjectElement.cpp -17 / +12 lines
Lines 1-5 a/Source/WebCore/svg/SVGForeignObjectElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
2
 * Copyright (C) 2006-2019 Apple Inc. All rights reserved.
3
 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
4
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
4
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
5
 *
5
 *
Lines 40-46 inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tag a/Source/WebCore/svg/SVGForeignObjectElement.cpp_sec2
40
    , SVGExternalResourcesRequired(this)
40
    , SVGExternalResourcesRequired(this)
41
{
41
{
42
    ASSERT(hasTagName(SVGNames::foreignObjectTag));
42
    ASSERT(hasTagName(SVGNames::foreignObjectTag));
43
    registerAttributes();
43
    static std::once_flag onceFlag;
44
    std::call_once(onceFlag, [] {
45
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGForeignObjectElement::m_x>();
46
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGForeignObjectElement::m_y>();
47
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGForeignObjectElement::m_width>();
48
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGForeignObjectElement::m_height>();
49
    });
44
}
50
}
45
51
46
Ref<SVGForeignObjectElement> SVGForeignObjectElement::create(const QualifiedName& tagName, Document& document)
52
Ref<SVGForeignObjectElement> SVGForeignObjectElement::create(const QualifiedName& tagName, Document& document)
Lines 48-76 Ref<SVGForeignObjectElement> SVGForeignObjectElement::create(const QualifiedName a/Source/WebCore/svg/SVGForeignObjectElement.cpp_sec3
48
    return adoptRef(*new SVGForeignObjectElement(tagName, document));
54
    return adoptRef(*new SVGForeignObjectElement(tagName, document));
49
}
55
}
50
56
51
void SVGForeignObjectElement::registerAttributes()
52
{
53
    auto& registry = attributeRegistry();
54
    if (!registry.isEmpty())
55
        return;
56
    registry.registerAttribute<SVGNames::xAttr, &SVGForeignObjectElement::m_x>();
57
    registry.registerAttribute<SVGNames::yAttr, &SVGForeignObjectElement::m_y>();
58
    registry.registerAttribute<SVGNames::widthAttr, &SVGForeignObjectElement::m_width>();
59
    registry.registerAttribute<SVGNames::heightAttr, &SVGForeignObjectElement::m_height>();
60
}
61
62
void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
57
void SVGForeignObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
63
{
58
{
64
    SVGParsingError parseError = NoError;
59
    SVGParsingError parseError = NoError;
65
60
66
    if (name == SVGNames::xAttr)
61
    if (name == SVGNames::xAttr)
67
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
62
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
68
    else if (name == SVGNames::yAttr)
63
    else if (name == SVGNames::yAttr)
69
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
64
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
70
    else if (name == SVGNames::widthAttr)
65
    else if (name == SVGNames::widthAttr)
71
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
66
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
72
    else if (name == SVGNames::heightAttr)
67
    else if (name == SVGNames::heightAttr)
73
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
68
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
74
69
75
    reportAttributeParsingError(parseError, name, value);
70
    reportAttributeParsingError(parseError, name, value);
76
71
- a/Source/WebCore/svg/SVGForeignObjectElement.h -20 / +12 lines
Lines 19-25 a/Source/WebCore/svg/SVGForeignObjectElement.h_sec1
19
19
20
#pragma once
20
#pragma once
21
21
22
#include "SVGAnimatedLength.h"
23
#include "SVGExternalResourcesRequired.h"
22
#include "SVGExternalResourcesRequired.h"
24
#include "SVGGraphicsElement.h"
23
#include "SVGGraphicsElement.h"
25
#include "SVGNames.h"
24
#include "SVGNames.h"
Lines 32-63 class SVGForeignObjectElement final : public SVGGraphicsElement, public SVGExter a/Source/WebCore/svg/SVGForeignObjectElement.h_sec2
32
public:
31
public:
33
    static Ref<SVGForeignObjectElement> create(const QualifiedName&, Document&);
32
    static Ref<SVGForeignObjectElement> create(const QualifiedName&, Document&);
34
33
35
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
34
    const SVGLengthValue& x() const { return m_x->currentValue(); }
36
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
35
    const SVGLengthValue& y() const { return m_y->currentValue(); }
37
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
36
    const SVGLengthValue& width() const { return m_width->currentValue(); }
38
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
37
    const SVGLengthValue& height() const { return m_height->currentValue(); }
39
38
40
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
39
    SVGAnimatedLength& xAnimated() { return m_x; }
41
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
40
    SVGAnimatedLength& yAnimated() { return m_y; }
42
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
41
    SVGAnimatedLength& widthAnimated() { return m_width; }
43
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
42
    SVGAnimatedLength& heightAnimated() { return m_height; }
44
43
45
private:
44
private:
46
    SVGForeignObjectElement(const QualifiedName&, Document&);
45
    SVGForeignObjectElement(const QualifiedName&, Document&);
47
46
48
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
47
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
49
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
50
    static void registerAttributes();
51
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
48
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
52
49
53
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
50
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGForeignObjectElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
54
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
51
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
55
52
56
    static bool isKnownAttribute(const QualifiedName& attributeName)
57
    {
58
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
59
    }
60
61
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
53
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
62
    void svgAttributeChanged(const QualifiedName&) final;
54
    void svgAttributeChanged(const QualifiedName&) final;
63
55
Lines 70-79 private: a/Source/WebCore/svg/SVGForeignObjectElement.h_sec3
70
62
71
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
63
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
72
    PropertyRegistry m_propertyRegistry { *this };
64
    PropertyRegistry m_propertyRegistry { *this };
73
    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
65
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) };
74
    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
66
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) };
75
    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
67
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth) };
76
    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
68
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight) };
77
};
69
};
78
70
79
} // namespace WebCore
71
} // namespace WebCore
- a/Source/WebCore/svg/SVGImageElement.cpp -18 / +9 lines
Lines 3-9 a/Source/WebCore/svg/SVGImageElement.cpp_sec1
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
4
 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
5
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
5
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
6
 * Copyright (C) 2018 Apple Inc. All rights reserved.
6
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
7
 *
7
 *
8
 * This library is free software; you can redistribute it and/or
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Library General Public
9
 * modify it under the terms of the GNU Library General Public
Lines 43-52 inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& a/Source/WebCore/svg/SVGImageElement.cpp_sec2
43
    , SVGURIReference(this)
43
    , SVGURIReference(this)
44
    , m_imageLoader(*this)
44
    , m_imageLoader(*this)
45
{
45
{
46
    registerAttributes();
47
48
    static std::once_flag onceFlag;
46
    static std::once_flag onceFlag;
49
    std::call_once(onceFlag, [] {
47
    std::call_once(onceFlag, [] {
48
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGImageElement::m_x>();
49
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGImageElement::m_y>();
50
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGImageElement::m_width>();
51
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGImageElement::m_height>();
50
        PropertyRegistry::registerProperty<SVGNames::preserveAspectRatioAttr, &SVGImageElement::m_preserveAspectRatio>();
52
        PropertyRegistry::registerProperty<SVGNames::preserveAspectRatioAttr, &SVGImageElement::m_preserveAspectRatio>();
51
    });
53
    });
52
}
54
}
Lines 65-81 bool SVGImageElement::hasSingleSecurityOrigin() const a/Source/WebCore/svg/SVGImageElement.cpp_sec3
65
    return !image || image->hasSingleSecurityOrigin();
67
    return !image || image->hasSingleSecurityOrigin();
66
}
68
}
67
69
68
void SVGImageElement::registerAttributes()
69
{
70
    auto& registry = attributeRegistry();
71
    if (!registry.isEmpty())
72
        return;
73
    registry.registerAttribute<SVGNames::xAttr, &SVGImageElement::m_x>();
74
    registry.registerAttribute<SVGNames::yAttr, &SVGImageElement::m_y>();
75
    registry.registerAttribute<SVGNames::widthAttr, &SVGImageElement::m_width>();
76
    registry.registerAttribute<SVGNames::heightAttr, &SVGImageElement::m_height>();
77
}
78
79
void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
70
void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
80
{
71
{
81
    if (name == SVGNames::preserveAspectRatioAttr) {
72
    if (name == SVGNames::preserveAspectRatioAttr) {
Lines 88-100 void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri a/Source/WebCore/svg/SVGImageElement.cpp_sec4
88
    SVGParsingError parseError = NoError;
79
    SVGParsingError parseError = NoError;
89
80
90
    if (name == SVGNames::xAttr)
81
    if (name == SVGNames::xAttr)
91
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
82
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
92
    else if (name == SVGNames::yAttr)
83
    else if (name == SVGNames::yAttr)
93
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
84
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
94
    else if (name == SVGNames::widthAttr)
85
    else if (name == SVGNames::widthAttr)
95
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
86
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
96
    else if (name == SVGNames::heightAttr)
87
    else if (name == SVGNames::heightAttr)
97
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
88
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
98
89
99
    reportAttributeParsingError(parseError, name, value);
90
    reportAttributeParsingError(parseError, name, value);
100
91
- a/Source/WebCore/svg/SVGImageElement.h -20 / +12 lines
Lines 21-27 a/Source/WebCore/svg/SVGImageElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGExternalResourcesRequired.h"
24
#include "SVGExternalResourcesRequired.h"
26
#include "SVGGraphicsElement.h"
25
#include "SVGGraphicsElement.h"
27
#include "SVGImageLoader.h"
26
#include "SVGImageLoader.h"
Lines 37-70 public: a/Source/WebCore/svg/SVGImageElement.h_sec2
37
    bool hasSingleSecurityOrigin() const;
36
    bool hasSingleSecurityOrigin() const;
38
    const AtomicString& imageSourceURL() const final;
37
    const AtomicString& imageSourceURL() const final;
39
38
40
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
39
    const SVGLengthValue& x() const { return m_x->currentValue(); }
41
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
40
    const SVGLengthValue& y() const { return m_y->currentValue(); }
42
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
41
    const SVGLengthValue& width() const { return m_width->currentValue(); }
43
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
42
    const SVGLengthValue& height() const { return m_height->currentValue(); }
44
    const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio->currentValue(); }
43
    const SVGPreserveAspectRatioValue& preserveAspectRatio() const { return m_preserveAspectRatio->currentValue(); }
45
44
46
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
45
    SVGAnimatedLength& xAnimated() { return m_x; }
47
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
46
    SVGAnimatedLength& yAnimated() { return m_y; }
48
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
47
    SVGAnimatedLength& widthAnimated() { return m_width; }
49
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
48
    SVGAnimatedLength& heightAnimated() { return m_height; }
50
    SVGAnimatedPreserveAspectRatio& preserveAspectRatioAnimated() { return m_preserveAspectRatio; }
49
    SVGAnimatedPreserveAspectRatio& preserveAspectRatioAnimated() { return m_preserveAspectRatio; }
51
50
52
private:
51
private:
53
    SVGImageElement(const QualifiedName&, Document&);
52
    SVGImageElement(const QualifiedName&, Document&);
54
    
53
    
55
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
54
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
56
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
57
    static void registerAttributes();
58
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
55
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
59
56
60
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
57
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGImageElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
61
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
58
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
62
59
63
    static bool isKnownAttribute(const QualifiedName& attributeName)
64
    {
65
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
66
    }
67
68
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
60
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
69
    void svgAttributeChanged(const QualifiedName&) final;
61
    void svgAttributeChanged(const QualifiedName&) final;
70
62
Lines 81-90 private: a/Source/WebCore/svg/SVGImageElement.h_sec3
81
73
82
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
74
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
83
    PropertyRegistry m_propertyRegistry { *this };
75
    PropertyRegistry m_propertyRegistry { *this };
84
    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
76
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) };
85
    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
77
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) };
86
    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
78
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth) };
87
    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
79
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight) };
88
    Ref<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio { SVGAnimatedPreserveAspectRatio::create(this) };
80
    Ref<SVGAnimatedPreserveAspectRatio> m_preserveAspectRatio { SVGAnimatedPreserveAspectRatio::create(this) };
89
    SVGImageLoader m_imageLoader;
81
    SVGImageLoader m_imageLoader;
90
};
82
};
- a/Source/WebCore/svg/SVGLength.h -34 / +37 lines
Lines 1-5 a/Source/WebCore/svg/SVGLength.h_sec1
1
/*
1
/*
2
 * Copyright (C) 2016 Apple Inc. All rights reserved.
2
 * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
3
 *
3
 *
4
 * Redistribution and use in source and binary forms, with or without
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
5
 * modification, are permitted provided that the following conditions
Lines 26-36 a/Source/WebCore/svg/SVGLength.h_sec2
26
#pragma once
26
#pragma once
27
27
28
#include "SVGLengthValue.h"
28
#include "SVGLengthValue.h"
29
#include "SVGPropertyTearOff.h"
29
#include "SVGValueProperty.h"
30
30
31
namespace WebCore {
31
namespace WebCore {
32
32
33
class SVGLength : public SVGPropertyTearOff<SVGLengthValue> {
33
class SVGLength : public SVGValueProperty<SVGLengthValue> {
34
    using Base = SVGValueProperty<SVGLengthValue>;
35
    using Base::Base;
36
    using Base::m_value;
37
34
public:
38
public:
35
    // Forward declare these enums in the w3c naming scheme, for IDL generation
39
    // Forward declare these enums in the w3c naming scheme, for IDL generation
36
    enum {
40
    enum {
Lines 47-77 public: a/Source/WebCore/svg/SVGLength.h_sec3
47
        SVG_LENGTHTYPE_PC = LengthTypePC
51
        SVG_LENGTHTYPE_PC = LengthTypePC
48
    };
52
    };
49
53
50
    static Ref<SVGLength> create(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
54
    static Ref<SVGLength> create()
55
    {
56
        return adoptRef(*new SVGLength());
57
    }
58
59
    static Ref<SVGLength> create(const SVGLengthValue& value)
51
    {
60
    {
52
        return adoptRef(*new SVGLength(animatedProperty, role, value));
61
        return adoptRef(*new SVGLength(value));
53
    }
62
    }
54
63
55
    static Ref<SVGLength> create(const SVGLengthValue& initialValue = { })
64
    static Ref<SVGLength> create(SVGPropertyOwner* owner, SVGPropertyAccess access, const SVGLengthValue& value = { })
56
    {
65
    {
57
        return adoptRef(*new SVGLength(initialValue));
66
        return adoptRef(*new SVGLength(owner, access, value));
58
    }
67
    }
59
68
60
    template<typename T> static ExceptionOr<Ref<SVGLength>> create(ExceptionOr<T>&& initialValue)
69
    template<typename T>
70
    static ExceptionOr<Ref<SVGLength>> create(ExceptionOr<T>&& value)
61
    {
71
    {
62
        if (initialValue.hasException())
72
        if (value.hasException())
63
            return initialValue.releaseException();
73
            return value.releaseException();
64
        return create(initialValue.releaseReturnValue());
74
        return adoptRef(*new SVGLength(value.releaseReturnValue()));
75
    }
76
77
    Ref<SVGLength> clone() const
78
    {
79
        return SVGLength::create(m_value);
65
    }
80
    }
66
81
67
    unsigned short unitType()
82
    unsigned short unitType()
68
    {
83
    {
69
        return propertyReference().unitType();
84
        return m_value.unitType();
70
    }
85
    }
71
86
72
    ExceptionOr<float> valueForBindings()
87
    ExceptionOr<float> valueForBindings()
73
    {
88
    {
74
        return propertyReference().valueForBindings(SVGLengthContext { contextElement() });
89
        return m_value.valueForBindings(SVGLengthContext { contextElement() });
75
    }
90
    }
76
91
77
    ExceptionOr<void> setValueForBindings(float value)
92
    ExceptionOr<void> setValueForBindings(float value)
Lines 79-85 public: a/Source/WebCore/svg/SVGLength.h_sec4
79
        if (isReadOnly())
94
        if (isReadOnly())
80
            return Exception { NoModificationAllowedError };
95
            return Exception { NoModificationAllowedError };
81
96
82
        auto result = propertyReference().setValue(value, SVGLengthContext { contextElement() });
97
        auto result = m_value.setValue(value, SVGLengthContext { contextElement() });
83
        if (result.hasException())
98
        if (result.hasException())
84
            return result;
99
            return result;
85
        
100
        
Lines 89-95 public: a/Source/WebCore/svg/SVGLength.h_sec5
89
    
104
    
90
    float valueInSpecifiedUnits()
105
    float valueInSpecifiedUnits()
91
    {
106
    {
92
        return propertyReference().valueInSpecifiedUnits();
107
        return m_value.valueInSpecifiedUnits();
93
    }
108
    }
94
109
95
    ExceptionOr<void> setValueInSpecifiedUnits(float valueInSpecifiedUnits)
110
    ExceptionOr<void> setValueInSpecifiedUnits(float valueInSpecifiedUnits)
Lines 97-119 public: a/Source/WebCore/svg/SVGLength.h_sec6
97
        if (isReadOnly())
112
        if (isReadOnly())
98
            return Exception { NoModificationAllowedError };
113
            return Exception { NoModificationAllowedError };
99
114
100
        propertyReference().setValueInSpecifiedUnits(valueInSpecifiedUnits);
115
        m_value.setValueInSpecifiedUnits(valueInSpecifiedUnits);
101
        commitChange();
116
        commitChange();
102
        
103
        return { };
117
        return { };
104
    }
118
    }
105
    
119
    
106
    String valueAsString()
107
    {
108
        return propertyReference().valueAsString();
109
    }
110
111
    ExceptionOr<void> setValueAsString(const String& value)
120
    ExceptionOr<void> setValueAsString(const String& value)
112
    {
121
    {
113
        if (isReadOnly())
122
        if (isReadOnly())
114
            return Exception { NoModificationAllowedError };
123
            return Exception { NoModificationAllowedError };
115
124
116
        auto result = propertyReference().setValueAsString(value);
125
        auto result = m_value.setValueAsString(value);
117
        if (result.hasException())
126
        if (result.hasException())
118
            return result;
127
            return result;
119
        
128
        
Lines 126-132 public: a/Source/WebCore/svg/SVGLength.h_sec7
126
        if (isReadOnly())
135
        if (isReadOnly())
127
            return Exception { NoModificationAllowedError };
136
            return Exception { NoModificationAllowedError };
128
137
129
        auto result = propertyReference().newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
138
        auto result = m_value.newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
130
        if (result.hasException())
139
        if (result.hasException())
131
            return result;
140
            return result;
132
        
141
        
Lines 139-161 public: a/Source/WebCore/svg/SVGLength.h_sec8
139
        if (isReadOnly())
148
        if (isReadOnly())
140
            return Exception { NoModificationAllowedError };
149
            return Exception { NoModificationAllowedError };
141
150
142
        auto result = propertyReference().convertToSpecifiedUnits(unitType, SVGLengthContext { contextElement() });
151
        auto result = m_value.convertToSpecifiedUnits(unitType, SVGLengthContext { contextElement() });
143
        if (result.hasException())
152
        if (result.hasException())
144
            return result;
153
            return result;
145
        
154
        
146
        commitChange();
155
        commitChange();
147
        return result;
156
        return result;
148
    }
157
    }
149
158
    
150
private:
159
    String valueAsString() const override
151
    SVGLength(SVGLegacyAnimatedProperty& animatedProperty, SVGPropertyRole role, SVGLengthValue& value)
152
        : SVGPropertyTearOff<SVGLengthValue>(&animatedProperty, role, value)
153
    {
154
    }
155
156
    explicit SVGLength(const SVGLengthValue& initialValue)
157
        : SVGPropertyTearOff<SVGLengthValue>(initialValue)
158
    {
160
    {
161
        return m_value.valueAsString();
159
    }
162
    }
160
};
163
};
161
164
- a/Source/WebCore/svg/SVGLengthList.h -11 / +76 lines
Lines 1-5 a/Source/WebCore/svg/SVGLengthList.h_sec1
1
/*
1
/*
2
 * Copyright (C) 2016 Apple Inc. All rights reserved.
2
 * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
3
 *
3
 *
4
 * Redistribution and use in source and binary forms, with or without
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
5
 * modification, are permitted provided that the following conditions
Lines 25-51 a/Source/WebCore/svg/SVGLengthList.h_sec2
25
25
26
#pragma once
26
#pragma once
27
27
28
#include "SVGAnimatedListPropertyTearOff.h"
28
#include "SVGLength.h"
29
#include "SVGLengthListValues.h"
29
#include "SVGValuePropertyList.h"
30
#include "SVGListPropertyTearOff.h"
31
30
32
namespace WebCore {
31
namespace WebCore {
33
32
34
class SVGLengthList : public SVGListPropertyTearOff<SVGLengthListValues> {
33
class SVGLengthList : public SVGValuePropertyList<SVGLength> {
34
    using Base = SVGValuePropertyList<SVGLength>;
35
    using Base::Base;
36
35
public:
37
public:
36
    using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGLengthListValues>;
38
    static Ref<SVGLengthList> create(SVGLengthMode lengthMode = LengthModeOther)
37
    using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache;
39
    {
40
        return adoptRef(*new SVGLengthList(lengthMode));
41
    }
38
42
39
    static Ref<SVGLengthList> create(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGLengthListValues& values, ListWrapperCache& wrappers)
43
    static Ref<SVGLengthList> create(SVGPropertyOwner* owner, SVGPropertyAccess access, SVGLengthMode lengthMode)
40
    {
44
    {
41
        return adoptRef(*new SVGLengthList(animatedProperty, role, values, wrappers));
45
        return adoptRef(*new SVGLengthList(owner, access, lengthMode));
46
    }
47
48
    static Ref<SVGLengthList> create(const SVGLengthList& other, SVGPropertyAccess access)
49
    {
50
        return adoptRef(*new SVGLengthList(other, access));
51
    }
52
53
    SVGLengthMode lengthMode() const { return m_lengthMode; }
54
55
    bool parse(const String& value)
56
    {
57
        clearItems();
58
59
        auto upconvertedCharacters = StringView(value).upconvertedCharacters();
60
        const UChar* ptr = upconvertedCharacters;
61
        const UChar* end = ptr + value.length();
62
        while (ptr < end) {
63
            const UChar* start = ptr;
64
            while (ptr < end && *ptr != ',' && !isSVGSpace(*ptr))
65
                ptr++;
66
            if (ptr == start)
67
                break;
68
69
            String valueString(start, ptr - start);
70
            SVGLengthValue value(m_lengthMode);
71
            if (value.setValueAsString(valueString).hasException())
72
                break;
73
74
            append(SVGLength::create(value));
75
            skipOptionalSVGSpacesOrDelimiter(ptr, end);
76
        }
77
78
        return ptr == end;
42
    }
79
    }
43
80
81
    String valueAsString() const override
82
    {
83
        StringBuilder builder;
84
85
        for (const auto& length : m_items) {
86
            if (builder.length())
87
                builder.append(' ');
88
89
            builder.append(length->value().valueAsString());
90
        }
91
92
        return builder.toString();
93
    }
94
    
44
private:
95
private:
45
    SVGLengthList(AnimatedListPropertyTearOff& animatedProperty, SVGPropertyRole role, SVGLengthListValues& values, ListWrapperCache& wrappers)
96
    SVGLengthList(SVGLengthMode lengthMode)
46
        : SVGListPropertyTearOff<SVGLengthListValues>(animatedProperty, role, values, wrappers)
97
        : m_lengthMode(lengthMode)
47
    {
98
    {
48
    }
99
    }
100
101
    SVGLengthList(SVGPropertyOwner* owner, SVGPropertyAccess access, SVGLengthMode lengthMode)
102
        : Base(owner, access)
103
        , m_lengthMode(lengthMode)
104
    {
105
    }
106
107
    SVGLengthList(const SVGLengthList& other, SVGPropertyAccess access)
108
        : Base(other, access)
109
        , m_lengthMode(other.lengthMode())
110
    {
111
    }
112
113
    SVGLengthMode m_lengthMode { LengthModeOther };
49
};
114
};
50
115
51
} // namespace WebCore
116
} // namespace WebCore
- a/Source/WebCore/svg/SVGLengthListValues.cpp -69 lines
Lines 1-69 a/Source/WebCore/svg/SVGLengthListValues.cpp_sec1
1
/*
2
 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 */
20
21
#include "config.h"
22
#include "SVGLengthListValues.h"
23
24
#include "SVGParserUtilities.h"
25
#include <wtf/text/StringBuilder.h>
26
27
namespace WebCore {
28
29
void SVGLengthListValues::parse(const String& value, SVGLengthMode mode)
30
{
31
    clear();
32
33
    auto upconvertedCharacters = StringView(value).upconvertedCharacters();
34
    const UChar* ptr = upconvertedCharacters;
35
    const UChar* end = ptr + value.length();
36
    while (ptr < end) {
37
        const UChar* start = ptr;
38
        while (ptr < end && *ptr != ',' && !isSVGSpace(*ptr))
39
            ptr++;
40
        if (ptr == start)
41
            break;
42
43
        SVGLengthValue length(mode);
44
        String valueString(start, ptr - start);
45
        if (valueString.isEmpty())
46
            return;
47
        if (length.setValueAsString(valueString).hasException())
48
            return;
49
        append(length);
50
        skipOptionalSVGSpacesOrDelimiter(ptr, end);
51
    }
52
}
53
54
String SVGLengthListValues::valueAsString() const
55
{
56
    StringBuilder builder;
57
58
    unsigned size = this->size();
59
    for (unsigned i = 0; i < size; ++i) {
60
        if (i > 0)
61
            builder.append(' ');
62
63
        builder.append(at(i).valueAsString());
64
    }
65
66
    return builder.toString();
67
}
68
69
}
- a/Source/WebCore/svg/SVGLengthListValues.h -59 lines
Lines 1-59 a/Source/WebCore/svg/SVGLengthListValues.h_sec1
1
/*
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 */
20
21
#pragma once
22
23
#include "SVGLengthValue.h"
24
#include <wtf/Vector.h>
25
26
namespace WebCore {
27
28
class SVGLength;
29
class SVGLengthList;
30
31
class SVGLengthListValues final : public Vector<SVGLengthValue> {
32
public:
33
    void parse(const String& value, SVGLengthMode);
34
    String valueAsString() const;
35
};
36
37
template<>
38
struct SVGPropertyTraits<SVGLengthListValues> {
39
    static SVGLengthListValues initialValue() { return { }; }
40
    static SVGLengthListValues fromString(const String& string, SVGLengthMode lengthMode)
41
    {
42
        SVGLengthListValues list;
43
        list.parse(string, lengthMode);
44
        return list;
45
    }
46
    static Optional<SVGLengthListValues> parse(const QualifiedName& attrName, const String& string)
47
    {
48
        SVGLengthListValues list;
49
        list.parse(string, SVGLengthValue::lengthModeForAnimatedLengthAttribute(attrName));
50
        return list;
51
    }
52
    static String toString(const SVGLengthListValues& type) { return type.valueAsString(); }
53
54
    using ListItemType = SVGLengthValue;
55
    using ListItemTearOff = SVGLength;
56
    using ListPropertyTearOff = SVGLengthList;
57
};
58
59
} // namespace WebCore
- a/Source/WebCore/svg/SVGLineElement.cpp -18 / +14 lines
Lines 1-7 a/Source/WebCore/svg/SVGLineElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 35-41 inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& do a/Source/WebCore/svg/SVGLineElement.cpp_sec2
35
    , SVGExternalResourcesRequired(this)
35
    , SVGExternalResourcesRequired(this)
36
{
36
{
37
    ASSERT(hasTagName(SVGNames::lineTag));
37
    ASSERT(hasTagName(SVGNames::lineTag));
38
    registerAttributes();
38
39
    static std::once_flag onceFlag;
40
    std::call_once(onceFlag, [] {
41
        PropertyRegistry::registerProperty<SVGNames::x1Attr, &SVGLineElement::m_x1>();
42
        PropertyRegistry::registerProperty<SVGNames::y1Attr, &SVGLineElement::m_y1>();
43
        PropertyRegistry::registerProperty<SVGNames::x2Attr, &SVGLineElement::m_x2>();
44
        PropertyRegistry::registerProperty<SVGNames::y2Attr, &SVGLineElement::m_y2>();
45
    });
39
}
46
}
40
47
41
Ref<SVGLineElement> SVGLineElement::create(const QualifiedName& tagName, Document& document)
48
Ref<SVGLineElement> SVGLineElement::create(const QualifiedName& tagName, Document& document)
Lines 43-71 Ref<SVGLineElement> SVGLineElement::create(const QualifiedName& tagName, Documen a/Source/WebCore/svg/SVGLineElement.cpp_sec3
43
    return adoptRef(*new SVGLineElement(tagName, document));
50
    return adoptRef(*new SVGLineElement(tagName, document));
44
}
51
}
45
52
46
void SVGLineElement::registerAttributes()
47
{
48
    auto& registry = attributeRegistry();
49
    if (!registry.isEmpty())
50
        return;
51
    registry.registerAttribute<SVGNames::x1Attr, &SVGLineElement::m_x1>();
52
    registry.registerAttribute<SVGNames::y1Attr, &SVGLineElement::m_y1>();
53
    registry.registerAttribute<SVGNames::x2Attr, &SVGLineElement::m_x2>();
54
    registry.registerAttribute<SVGNames::y2Attr, &SVGLineElement::m_y2>();
55
}
56
57
void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
53
void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
58
{
54
{
59
    SVGParsingError parseError = NoError;
55
    SVGParsingError parseError = NoError;
60
56
61
    if (name == SVGNames::x1Attr)
57
    if (name == SVGNames::x1Attr)
62
        m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
58
        m_x1->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
63
    else if (name == SVGNames::y1Attr)
59
    else if (name == SVGNames::y1Attr)
64
        m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
60
        m_y1->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
65
    else if (name == SVGNames::x2Attr)
61
    else if (name == SVGNames::x2Attr)
66
        m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
62
        m_x2->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
67
    else if (name == SVGNames::y2Attr)
63
    else if (name == SVGNames::y2Attr)
68
        m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
64
        m_y2->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
69
65
70
    reportAttributeParsingError(parseError, name, value);
66
    reportAttributeParsingError(parseError, name, value);
71
67
Lines 75-81 void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin a/Source/WebCore/svg/SVGLineElement.cpp_sec4
75
71
76
void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
72
void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
77
{
73
{
78
    if (isKnownAttribute(attrName)) {
74
    if (PropertyRegistry::isKnownAttribute(attrName)) {
79
        InstanceInvalidationGuard guard(*this);
75
        InstanceInvalidationGuard guard(*this);
80
        updateRelativeLengthsInformation();
76
        updateRelativeLengthsInformation();
81
77
- a/Source/WebCore/svg/SVGLineElement.h -20 / +12 lines
Lines 21-27 a/Source/WebCore/svg/SVGLineElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGExternalResourcesRequired.h"
24
#include "SVGExternalResourcesRequired.h"
26
#include "SVGGeometryElement.h"
25
#include "SVGGeometryElement.h"
27
#include "SVGNames.h"
26
#include "SVGNames.h"
Lines 33-64 class SVGLineElement final : public SVGGeometryElement, public SVGExternalResour a/Source/WebCore/svg/SVGLineElement.h_sec2
33
public:
32
public:
34
    static Ref<SVGLineElement> create(const QualifiedName&, Document&);
33
    static Ref<SVGLineElement> create(const QualifiedName&, Document&);
35
34
36
    const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); }
35
    const SVGLengthValue& x1() const { return m_x1->currentValue(); }
37
    const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); }
36
    const SVGLengthValue& y1() const { return m_y1->currentValue(); }
38
    const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); }
37
    const SVGLengthValue& x2() const { return m_x2->currentValue(); }
39
    const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); }
38
    const SVGLengthValue& y2() const { return m_y2->currentValue(); }
40
39
41
    RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); }
40
    SVGAnimatedLength& x1Animated() { return m_x1; }
42
    RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); }
41
    SVGAnimatedLength& y1Animated() { return m_y1; }
43
    RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); }
42
    SVGAnimatedLength& x2Animated() { return m_x2; }
44
    RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); }
43
    SVGAnimatedLength& y2Animated() { return m_y2; }
45
44
46
private:
45
private:
47
    SVGLineElement(const QualifiedName&, Document&);
46
    SVGLineElement(const QualifiedName&, Document&);
48
47
49
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>;
48
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>;
50
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
51
    static void registerAttributes();
52
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
49
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
53
50
54
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>;
51
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGLineElement, SVGGeometryElement, SVGExternalResourcesRequired>;
55
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
52
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
56
53
57
    static bool isKnownAttribute(const QualifiedName& attributeName)
58
    {
59
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
60
    }
61
62
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
54
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
63
    void svgAttributeChanged(const QualifiedName&) final;
55
    void svgAttributeChanged(const QualifiedName&) final;
64
56
Lines 68-77 private: a/Source/WebCore/svg/SVGLineElement.h_sec3
68
60
69
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
61
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
70
    PropertyRegistry m_propertyRegistry { *this };
62
    PropertyRegistry m_propertyRegistry { *this };
71
    SVGAnimatedLengthAttribute m_x1 { LengthModeWidth };
63
    Ref<SVGAnimatedLength> m_x1 { SVGAnimatedLength::create(this, LengthModeWidth) };
72
    SVGAnimatedLengthAttribute m_y1 { LengthModeHeight };
64
    Ref<SVGAnimatedLength> m_y1 { SVGAnimatedLength::create(this, LengthModeHeight) };
73
    SVGAnimatedLengthAttribute m_x2 { LengthModeWidth };
65
    Ref<SVGAnimatedLength> m_x2 { SVGAnimatedLength::create(this, LengthModeWidth) };
74
    SVGAnimatedLengthAttribute m_y2 { LengthModeHeight };
66
    Ref<SVGAnimatedLength> m_y2 { SVGAnimatedLength::create(this, LengthModeHeight) };
75
};
67
};
76
68
77
} // namespace WebCore
69
} // namespace WebCore
- a/Source/WebCore/svg/SVGLinearGradientElement.cpp -18 / +14 lines
Lines 4-10 a/Source/WebCore/svg/SVGLinearGradientElement.cpp_sec1
4
 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4
 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
5
 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5
 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
6
 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6
 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7
 * Copyright (C) 2018 Apple Inc. All rights reserved.
7
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
8
 *
8
 *
9
 * This library is free software; you can redistribute it and/or
9
 * This library is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU Library General Public
10
 * modify it under the terms of the GNU Library General Public
Lines 44-50 inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& t a/Source/WebCore/svg/SVGLinearGradientElement.cpp_sec2
44
{
44
{
45
    // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified.
45
    // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified.
46
    ASSERT(hasTagName(SVGNames::linearGradientTag));
46
    ASSERT(hasTagName(SVGNames::linearGradientTag));
47
    registerAttributes();
47
48
    static std::once_flag onceFlag;
49
    std::call_once(onceFlag, [] {
50
        PropertyRegistry::registerProperty<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>();
51
        PropertyRegistry::registerProperty<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>();
52
        PropertyRegistry::registerProperty<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>();
53
        PropertyRegistry::registerProperty<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>();
54
    });
48
}
55
}
49
56
50
Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedName& tagName, Document& document)
57
Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedName& tagName, Document& document)
Lines 52-80 Ref<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedNa a/Source/WebCore/svg/SVGLinearGradientElement.cpp_sec3
52
    return adoptRef(*new SVGLinearGradientElement(tagName, document));
59
    return adoptRef(*new SVGLinearGradientElement(tagName, document));
53
}
60
}
54
61
55
void SVGLinearGradientElement::registerAttributes()
56
{
57
    auto& registry = attributeRegistry();
58
    if (!registry.isEmpty())
59
        return;
60
    registry.registerAttribute<SVGNames::x1Attr, &SVGLinearGradientElement::m_x1>();
61
    registry.registerAttribute<SVGNames::y1Attr, &SVGLinearGradientElement::m_y1>();
62
    registry.registerAttribute<SVGNames::x2Attr, &SVGLinearGradientElement::m_x2>();
63
    registry.registerAttribute<SVGNames::y2Attr, &SVGLinearGradientElement::m_y2>();
64
}
65
66
void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
62
void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
67
{
63
{
68
    SVGParsingError parseError = NoError;
64
    SVGParsingError parseError = NoError;
69
65
70
    if (name == SVGNames::x1Attr)
66
    if (name == SVGNames::x1Attr)
71
        m_x1.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
67
        m_x1->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
72
    else if (name == SVGNames::y1Attr)
68
    else if (name == SVGNames::y1Attr)
73
        m_y1.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
69
        m_y1->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
74
    else if (name == SVGNames::x2Attr)
70
    else if (name == SVGNames::x2Attr)
75
        m_x2.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
71
        m_x2->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
76
    else if (name == SVGNames::y2Attr)
72
    else if (name == SVGNames::y2Attr)
77
        m_y2.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
73
        m_y2->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
78
74
79
    reportAttributeParsingError(parseError, name, value);
75
    reportAttributeParsingError(parseError, name, value);
80
76
Lines 83-89 void SVGLinearGradientElement::parseAttribute(const QualifiedName& name, const A a/Source/WebCore/svg/SVGLinearGradientElement.cpp_sec4
83
79
84
void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName)
80
void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName)
85
{
81
{
86
    if (isKnownAttribute(attrName)) {
82
    if (PropertyRegistry::isKnownAttribute(attrName)) {
87
        InstanceInvalidationGuard guard(*this);
83
        InstanceInvalidationGuard guard(*this);
88
        updateRelativeLengthsInformation();
84
        updateRelativeLengthsInformation();
89
        if (RenderObject* object = renderer())
85
        if (RenderObject* object = renderer())
- a/Source/WebCore/svg/SVGLinearGradientElement.h -20 / +12 lines
Lines 21-27 a/Source/WebCore/svg/SVGLinearGradientElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGGradientElement.h"
24
#include "SVGGradientElement.h"
26
#include "SVGNames.h"
25
#include "SVGNames.h"
27
26
Lines 36-67 public: a/Source/WebCore/svg/SVGLinearGradientElement.h_sec2
36
35
37
    bool collectGradientAttributes(LinearGradientAttributes&);
36
    bool collectGradientAttributes(LinearGradientAttributes&);
38
37
39
    const SVGLengthValue& x1() const { return m_x1.currentValue(attributeOwnerProxy()); }
38
    const SVGLengthValue& x1() const { return m_x1->currentValue(); }
40
    const SVGLengthValue& y1() const { return m_y1.currentValue(attributeOwnerProxy()); }
39
    const SVGLengthValue& y1() const { return m_y1->currentValue(); }
41
    const SVGLengthValue& x2() const { return m_x2.currentValue(attributeOwnerProxy()); }
40
    const SVGLengthValue& x2() const { return m_x2->currentValue(); }
42
    const SVGLengthValue& y2() const { return m_y2.currentValue(attributeOwnerProxy()); }
41
    const SVGLengthValue& y2() const { return m_y2->currentValue(); }
43
42
44
    RefPtr<SVGAnimatedLength> x1Animated() { return m_x1.animatedProperty(attributeOwnerProxy()); }
43
    SVGAnimatedLength& x1Animated() { return m_x1; }
45
    RefPtr<SVGAnimatedLength> y1Animated() { return m_y1.animatedProperty(attributeOwnerProxy()); }
44
    SVGAnimatedLength& y1Animated() { return m_y1; }
46
    RefPtr<SVGAnimatedLength> x2Animated() { return m_x2.animatedProperty(attributeOwnerProxy()); }
45
    SVGAnimatedLength& x2Animated() { return m_x2; }
47
    RefPtr<SVGAnimatedLength> y2Animated() { return m_y2.animatedProperty(attributeOwnerProxy()); }
46
    SVGAnimatedLength& y2Animated() { return m_y2; }
48
47
49
private:
48
private:
50
    SVGLinearGradientElement(const QualifiedName&, Document&);
49
    SVGLinearGradientElement(const QualifiedName&, Document&);
51
50
52
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLinearGradientElement, SVGGradientElement>;
51
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGLinearGradientElement, SVGGradientElement>;
53
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
54
    static void registerAttributes();
55
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
52
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
56
53
57
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGLinearGradientElement, SVGGradientElement>;
54
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGLinearGradientElement, SVGGradientElement>;
58
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
55
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
59
56
60
    static bool isKnownAttribute(const QualifiedName& attributeName)
61
    {
62
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
63
    }
64
65
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
57
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
66
    void svgAttributeChanged(const QualifiedName&) override;
58
    void svgAttributeChanged(const QualifiedName&) override;
67
59
Lines 71-80 private: a/Source/WebCore/svg/SVGLinearGradientElement.h_sec3
71
63
72
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
64
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
73
    PropertyRegistry m_propertyRegistry { *this };
65
    PropertyRegistry m_propertyRegistry { *this };
74
    SVGAnimatedLengthAttribute m_x1 { LengthModeWidth };
66
    Ref<SVGAnimatedLength> m_x1 { SVGAnimatedLength::create(this, LengthModeWidth) };
75
    SVGAnimatedLengthAttribute m_y1 { LengthModeHeight };
67
    Ref<SVGAnimatedLength> m_y1 { SVGAnimatedLength::create(this, LengthModeHeight) };
76
    SVGAnimatedLengthAttribute m_x2 { LengthModeWidth, "100%" };
68
    Ref<SVGAnimatedLength> m_x2 { SVGAnimatedLength::create(this, LengthModeWidth, "100%") };
77
    SVGAnimatedLengthAttribute m_y2 { LengthModeHeight };
69
    Ref<SVGAnimatedLength> m_y2 { SVGAnimatedLength::create(this, LengthModeHeight) };
78
};
70
};
79
71
80
} // namespace WebCore
72
} // namespace WebCore
- a/Source/WebCore/svg/SVGMarkerElement.cpp -18 / +10 lines
Lines 40-49 inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document a/Source/WebCore/svg/SVGMarkerElement.cpp_sec1
40
{
40
{
41
    // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified.
41
    // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified.
42
    ASSERT(hasTagName(SVGNames::markerTag));
42
    ASSERT(hasTagName(SVGNames::markerTag));
43
    registerAttributes();
44
43
45
    static std::once_flag onceFlag;
44
    static std::once_flag onceFlag;
46
    std::call_once(onceFlag, [] {
45
    std::call_once(onceFlag, [] {
46
        PropertyRegistry::registerProperty<SVGNames::refXAttr, &SVGMarkerElement::m_refX>();
47
        PropertyRegistry::registerProperty<SVGNames::refYAttr, &SVGMarkerElement::m_refY>();
48
        PropertyRegistry::registerProperty<SVGNames::markerWidthAttr, &SVGMarkerElement::m_markerWidth>();
49
        PropertyRegistry::registerProperty<SVGNames::markerHeightAttr, &SVGMarkerElement::m_markerHeight>();
47
        PropertyRegistry::registerProperty<SVGNames::markerUnitsAttr, SVGMarkerUnitsType, &SVGMarkerElement::m_markerUnits>();
50
        PropertyRegistry::registerProperty<SVGNames::markerUnitsAttr, SVGMarkerUnitsType, &SVGMarkerElement::m_markerUnits>();
48
        PropertyRegistry::registerProperty<SVGNames::orientAttr, &SVGMarkerElement::m_orientAngle, &SVGMarkerElement::m_orientType>();
51
        PropertyRegistry::registerProperty<SVGNames::orientAttr, &SVGMarkerElement::m_orientAngle, &SVGMarkerElement::m_orientType>();
49
    });
52
    });
Lines 59-75 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float a/Source/WebCore/svg/SVGMarkerElement.cpp_sec2
59
    return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight);
62
    return SVGFitToViewBox::viewBoxToViewTransform(viewBox(), preserveAspectRatio(), viewWidth, viewHeight);
60
}
63
}
61
64
62
void SVGMarkerElement::registerAttributes()
63
{
64
    auto& registry = attributeRegistry();
65
    if (!registry.isEmpty())
66
        return;
67
    registry.registerAttribute<SVGNames::refXAttr, &SVGMarkerElement::m_refX>();
68
    registry.registerAttribute<SVGNames::refYAttr, &SVGMarkerElement::m_refY>();
69
    registry.registerAttribute<SVGNames::markerWidthAttr, &SVGMarkerElement::m_markerWidth>();
70
    registry.registerAttribute<SVGNames::markerHeightAttr, &SVGMarkerElement::m_markerHeight>();
71
}
72
73
void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
65
void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
74
{
66
{
75
    if (name == SVGNames::markerUnitsAttr) {
67
    if (name == SVGNames::markerUnitsAttr) {
Lines 89-101 void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicStr a/Source/WebCore/svg/SVGMarkerElement.cpp_sec3
89
    SVGParsingError parseError = NoError;
81
    SVGParsingError parseError = NoError;
90
82
91
    if (name == SVGNames::refXAttr)
83
    if (name == SVGNames::refXAttr)
92
        m_refX.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
84
        m_refX->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
93
    else if (name == SVGNames::refYAttr)
85
    else if (name == SVGNames::refYAttr)
94
        m_refY.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
86
        m_refY->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
95
    else if (name == SVGNames::markerWidthAttr)
87
    else if (name == SVGNames::markerWidthAttr)
96
        m_markerWidth.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
88
        m_markerWidth->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
97
    else if (name == SVGNames::markerHeightAttr)
89
    else if (name == SVGNames::markerHeightAttr)
98
        m_markerHeight.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
90
        m_markerHeight->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
99
91
100
    reportAttributeParsingError(parseError, name, value);
92
    reportAttributeParsingError(parseError, name, value);
101
93
Lines 106-114 void SVGMarkerElement::parseAttribute(const QualifiedName& name, const AtomicStr a/Source/WebCore/svg/SVGMarkerElement.cpp_sec4
106
98
107
void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
99
void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
108
{
100
{
109
    if (isKnownAttribute(attrName)) {
101
    if (PropertyRegistry::isKnownAttribute(attrName)) {
110
        InstanceInvalidationGuard guard(*this);
102
        InstanceInvalidationGuard guard(*this);
111
        if (isAnimatedLengthAttribute(attrName))
103
        if (PropertyRegistry::isAnimatedLengthAttribute(attrName))
112
            updateRelativeLengthsInformation();
104
            updateRelativeLengthsInformation();
113
        if (RenderObject* object = renderer())
105
        if (RenderObject* object = renderer())
114
            object->setNeedsLayout();
106
            object->setNeedsLayout();
- a/Source/WebCore/svg/SVGMarkerElement.h -21 / +12 lines
Lines 21-27 a/Source/WebCore/svg/SVGMarkerElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGElement.h"
24
#include "SVGElement.h"
26
#include "SVGExternalResourcesRequired.h"
25
#include "SVGExternalResourcesRequired.h"
27
#include "SVGFitToViewBox.h"
26
#include "SVGFitToViewBox.h"
Lines 53-70 public: a/Source/WebCore/svg/SVGMarkerElement.h_sec2
53
    void setOrientToAuto();
52
    void setOrientToAuto();
54
    void setOrientToAngle(SVGAngle&);
53
    void setOrientToAngle(SVGAngle&);
55
54
56
    const SVGLengthValue& refX() const { return m_refX.currentValue(attributeOwnerProxy()); }
55
    const SVGLengthValue& refX() const { return m_refX->currentValue(); }
57
    const SVGLengthValue& refY() const { return m_refY.currentValue(attributeOwnerProxy()); }
56
    const SVGLengthValue& refY() const { return m_refY->currentValue(); }
58
    const SVGLengthValue& markerWidth() const { return m_markerWidth.currentValue(attributeOwnerProxy()); }
57
    const SVGLengthValue& markerWidth() const { return m_markerWidth->currentValue(); }
59
    const SVGLengthValue& markerHeight() const { return m_markerHeight.currentValue(attributeOwnerProxy()); }
58
    const SVGLengthValue& markerHeight() const { return m_markerHeight->currentValue(); }
60
    SVGMarkerUnitsType markerUnits() const { return m_markerUnits->currentValue<SVGMarkerUnitsType>(); }
59
    SVGMarkerUnitsType markerUnits() const { return m_markerUnits->currentValue<SVGMarkerUnitsType>(); }
61
    const SVGAngleValue& orientAngle() const { return m_orientAngle->currentValue(); }
60
    const SVGAngleValue& orientAngle() const { return m_orientAngle->currentValue(); }
62
    SVGMarkerOrientType orientType() const { return m_orientType->currentValue<SVGMarkerOrientType>(); }
61
    SVGMarkerOrientType orientType() const { return m_orientType->currentValue<SVGMarkerOrientType>(); }
63
62
64
    RefPtr<SVGAnimatedLength> refXAnimated() { return m_refX.animatedProperty(attributeOwnerProxy()); }
63
    SVGAnimatedLength& refXAnimated() { return m_refX; }
65
    RefPtr<SVGAnimatedLength> refYAnimated() { return m_refY.animatedProperty(attributeOwnerProxy()); }
64
    SVGAnimatedLength& refYAnimated() { return m_refY; }
66
    RefPtr<SVGAnimatedLength> markerWidthAnimated() { return m_markerWidth.animatedProperty(attributeOwnerProxy()); }
65
    SVGAnimatedLength& markerWidthAnimated() { return m_markerWidth; }
67
    RefPtr<SVGAnimatedLength> markerHeightAnimated() { return m_markerHeight.animatedProperty(attributeOwnerProxy()); }
66
    SVGAnimatedLength& markerHeightAnimated() { return m_markerHeight; }
68
    SVGAnimatedEnumeration& markerUnitsAnimated() { return m_markerUnits; }
67
    SVGAnimatedEnumeration& markerUnitsAnimated() { return m_markerUnits; }
69
    SVGAnimatedAngle& orientAngleAnimated() { return m_orientAngle; }
68
    SVGAnimatedAngle& orientAngleAnimated() { return m_orientAngle; }
70
    Ref<SVGAnimatedEnumeration> orientTypeAnimated() { return m_orientType.copyRef(); }
69
    Ref<SVGAnimatedEnumeration> orientTypeAnimated() { return m_orientType.copyRef(); }
Lines 73-91 private: a/Source/WebCore/svg/SVGMarkerElement.h_sec3
73
    SVGMarkerElement(const QualifiedName&, Document&);
72
    SVGMarkerElement(const QualifiedName&, Document&);
74
73
75
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
74
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
76
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
77
    static void registerAttributes();
78
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
75
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
79
76
80
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
77
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGMarkerElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
81
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
78
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
82
79
83
    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
84
    static bool isKnownAttribute(const QualifiedName& attributeName)
85
    {
86
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
87
    }
88
89
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
80
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
90
    void svgAttributeChanged(const QualifiedName&) override;
81
    void svgAttributeChanged(const QualifiedName&) override;
91
    void childrenChanged(const ChildChange&) override;
82
    void childrenChanged(const ChildChange&) override;
Lines 102-111 private: a/Source/WebCore/svg/SVGMarkerElement.h_sec4
102
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
93
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
103
94
104
    PropertyRegistry m_propertyRegistry { *this };
95
    PropertyRegistry m_propertyRegistry { *this };
105
    SVGAnimatedLengthAttribute m_refX { LengthModeWidth };
96
    Ref<SVGAnimatedLength> m_refX { SVGAnimatedLength::create(this, LengthModeWidth) };
106
    SVGAnimatedLengthAttribute m_refY { LengthModeHeight };
97
    Ref<SVGAnimatedLength> m_refY { SVGAnimatedLength::create(this, LengthModeHeight) };
107
    SVGAnimatedLengthAttribute m_markerWidth { LengthModeWidth, "3" };
98
    Ref<SVGAnimatedLength> m_markerWidth { SVGAnimatedLength::create(this, LengthModeWidth, "3") };
108
    SVGAnimatedLengthAttribute m_markerHeight { LengthModeHeight, "3" };
99
    Ref<SVGAnimatedLength> m_markerHeight { SVGAnimatedLength::create(this, LengthModeHeight, "3") };
109
    Ref<SVGAnimatedEnumeration> m_markerUnits { SVGAnimatedEnumeration::create(this, SVGMarkerUnitsStrokeWidth) };
100
    Ref<SVGAnimatedEnumeration> m_markerUnits { SVGAnimatedEnumeration::create(this, SVGMarkerUnitsStrokeWidth) };
110
    Ref<SVGAnimatedAngle> m_orientAngle { SVGAnimatedAngle::create(this) };
101
    Ref<SVGAnimatedAngle> m_orientAngle { SVGAnimatedAngle::create(this) };
111
    Ref<SVGAnimatedOrientType> m_orientType { SVGAnimatedOrientType::create(this, SVGMarkerOrientAngle) };
102
    Ref<SVGAnimatedOrientType> m_orientType { SVGAnimatedOrientType::create(this, SVGMarkerOrientAngle) };
- a/Source/WebCore/svg/SVGMaskElement.cpp -19 / +11 lines
Lines 5-11 a/Source/WebCore/svg/SVGMaskElement.cpp_sec1
5
 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
5
 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6
 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
6
 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
7
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
7
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
8
 * Copyright (C) 2018 Apple Inc. All rights reserved.
8
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
9
 *
9
 *
10
 * This library is free software; you can redistribute it and/or
10
 * This library is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU Library General Public
11
 * modify it under the terms of the GNU Library General Public
Lines 47-56 inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& do a/Source/WebCore/svg/SVGMaskElement.cpp_sec2
47
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
47
    // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified.
48
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
48
    // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified.
49
    ASSERT(hasTagName(SVGNames::maskTag));
49
    ASSERT(hasTagName(SVGNames::maskTag));
50
    registerAttributes();
51
50
52
    static std::once_flag onceFlag;
51
    static std::once_flag onceFlag;
53
    std::call_once(onceFlag, [] {
52
    std::call_once(onceFlag, [] {
53
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGMaskElement::m_x>();
54
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGMaskElement::m_y>();
55
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGMaskElement::m_width>();
56
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGMaskElement::m_height>();
54
        PropertyRegistry::registerProperty<SVGNames::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>();
57
        PropertyRegistry::registerProperty<SVGNames::maskUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskUnits>();
55
        PropertyRegistry::registerProperty<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>();
58
        PropertyRegistry::registerProperty<SVGNames::maskContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGMaskElement::m_maskContentUnits>();
56
    });
59
    });
Lines 61-77 Ref<SVGMaskElement> SVGMaskElement::create(const QualifiedName& tagName, Documen a/Source/WebCore/svg/SVGMaskElement.cpp_sec3
61
    return adoptRef(*new SVGMaskElement(tagName, document));
64
    return adoptRef(*new SVGMaskElement(tagName, document));
62
}
65
}
63
66
64
void SVGMaskElement::registerAttributes()
65
{
66
    auto& registry = attributeRegistry();
67
    if (!registry.isEmpty())
68
        return;
69
    registry.registerAttribute<SVGNames::xAttr, &SVGMaskElement::m_x>();
70
    registry.registerAttribute<SVGNames::yAttr, &SVGMaskElement::m_y>();
71
    registry.registerAttribute<SVGNames::widthAttr, &SVGMaskElement::m_width>();
72
    registry.registerAttribute<SVGNames::heightAttr, &SVGMaskElement::m_height>();
73
}
74
75
void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
67
void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
76
{
68
{
77
    if (name == SVGNames::maskUnitsAttr) {
69
    if (name == SVGNames::maskUnitsAttr) {
Lines 90-102 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin a/Source/WebCore/svg/SVGMaskElement.cpp_sec4
90
    SVGParsingError parseError = NoError;
82
    SVGParsingError parseError = NoError;
91
83
92
    if (name == SVGNames::xAttr)
84
    if (name == SVGNames::xAttr)
93
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
85
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
94
    else if (name == SVGNames::yAttr)
86
    else if (name == SVGNames::yAttr)
95
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
87
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
96
    else if (name == SVGNames::widthAttr)
88
    else if (name == SVGNames::widthAttr)
97
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
89
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
98
    else if (name == SVGNames::heightAttr)
90
    else if (name == SVGNames::heightAttr)
99
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
91
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
100
92
101
    reportAttributeParsingError(parseError, name, value);
93
    reportAttributeParsingError(parseError, name, value);
102
94
Lines 107-119 void SVGMaskElement::parseAttribute(const QualifiedName& name, const AtomicStrin a/Source/WebCore/svg/SVGMaskElement.cpp_sec5
107
99
108
void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
100
void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
109
{
101
{
110
    if (isAnimatedLengthAttribute(attrName)) {
102
    if (PropertyRegistry::isAnimatedLengthAttribute(attrName)) {
111
        InstanceInvalidationGuard guard(*this);
103
        InstanceInvalidationGuard guard(*this);
112
        invalidateSVGPresentationAttributeStyle();
104
        invalidateSVGPresentationAttributeStyle();
113
        return;
105
        return;
114
    }
106
    }
115
107
116
    if (isKnownAttribute(attrName)) {
108
    if (PropertyRegistry::isKnownAttribute(attrName)) {
117
        if (auto* renderer = this->renderer())
109
        if (auto* renderer = this->renderer())
118
            renderer->setNeedsLayout();
110
            renderer->setNeedsLayout();
119
        return;
111
        return;
- a/Source/WebCore/svg/SVGMaskElement.h -14 / +12 lines
Lines 20-26 a/Source/WebCore/svg/SVGMaskElement.h_sec1
20
20
21
#pragma once
21
#pragma once
22
22
23
#include "SVGAnimatedLength.h"
24
#include "SVGElement.h"
23
#include "SVGElement.h"
25
#include "SVGExternalResourcesRequired.h"
24
#include "SVGExternalResourcesRequired.h"
26
#include "SVGNames.h"
25
#include "SVGNames.h"
Lines 34-50 class SVGMaskElement final : public SVGElement, public SVGExternalResourcesRequi a/Source/WebCore/svg/SVGMaskElement.h_sec2
34
public:
33
public:
35
    static Ref<SVGMaskElement> create(const QualifiedName&, Document&);
34
    static Ref<SVGMaskElement> create(const QualifiedName&, Document&);
36
35
37
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
36
    const SVGLengthValue& x() const { return m_x->currentValue(); }
38
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
37
    const SVGLengthValue& y() const { return m_y->currentValue(); }
39
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
38
    const SVGLengthValue& width() const { return m_width->currentValue(); }
40
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
39
    const SVGLengthValue& height() const { return m_height->currentValue(); }
41
    SVGUnitTypes::SVGUnitType maskUnits() const { return m_maskUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
40
    SVGUnitTypes::SVGUnitType maskUnits() const { return m_maskUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
42
    SVGUnitTypes::SVGUnitType maskContentUnits() const { return m_maskContentUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
41
    SVGUnitTypes::SVGUnitType maskContentUnits() const { return m_maskContentUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
43
42
44
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
43
    SVGAnimatedLength& xAnimated() { return m_x; }
45
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
44
    SVGAnimatedLength& yAnimated() { return m_y; }
46
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
45
    SVGAnimatedLength& widthAnimated() { return m_width; }
47
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
46
    SVGAnimatedLength& heightAnimated() { return m_height; }
48
    SVGAnimatedEnumeration& maskUnitsAnimated() { return m_maskUnits; }
47
    SVGAnimatedEnumeration& maskUnitsAnimated() { return m_maskUnits; }
49
    SVGAnimatedEnumeration& maskContentUnitsAnimated() { return m_maskContentUnits; }
48
    SVGAnimatedEnumeration& maskContentUnitsAnimated() { return m_maskContentUnits; }
50
49
Lines 59-65 private: a/Source/WebCore/svg/SVGMaskElement.h_sec3
59
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGMaskElement, SVGElement, SVGExternalResourcesRequired, SVGTests>;
58
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGMaskElement, SVGElement, SVGExternalResourcesRequired, SVGTests>;
60
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
59
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
61
60
62
    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
63
    static bool isKnownAttribute(const QualifiedName& attributeName)
61
    static bool isKnownAttribute(const QualifiedName& attributeName)
64
    {
62
    {
65
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
63
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
Lines 77-86 private: a/Source/WebCore/svg/SVGMaskElement.h_sec4
77
75
78
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
76
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
79
    PropertyRegistry m_propertyRegistry { *this };
77
    PropertyRegistry m_propertyRegistry { *this };
80
    SVGAnimatedLengthAttribute m_x { LengthModeWidth, "-10%" };
78
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth, "-10%") };
81
    SVGAnimatedLengthAttribute m_y { LengthModeHeight, "-10%" };
79
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight, "-10%") };
82
    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "120%" };
80
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth, "120%") };
83
    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "120%" };
81
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight, "120%") };
84
    Ref<SVGAnimatedEnumeration> m_maskUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) };
82
    Ref<SVGAnimatedEnumeration> m_maskUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) };
85
    Ref<SVGAnimatedEnumeration> m_maskContentUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) };
83
    Ref<SVGAnimatedEnumeration> m_maskContentUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) };
86
};
84
};
- a/Source/WebCore/svg/SVGPatternElement.cpp -9 / +9 lines
Lines 57-62 inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Docume a/Source/WebCore/svg/SVGPatternElement.cpp_sec1
57
57
58
    static std::once_flag onceFlag;
58
    static std::once_flag onceFlag;
59
    std::call_once(onceFlag, [] {
59
    std::call_once(onceFlag, [] {
60
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGPatternElement::m_x>();
61
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGPatternElement::m_y>();
62
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGPatternElement::m_width>();
63
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGPatternElement::m_height>();
60
        PropertyRegistry::registerProperty<SVGNames::patternUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternUnits>();
64
        PropertyRegistry::registerProperty<SVGNames::patternUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternUnits>();
61
        PropertyRegistry::registerProperty<SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternContentUnits>();
65
        PropertyRegistry::registerProperty<SVGNames::patternContentUnitsAttr, SVGUnitTypes::SVGUnitType, &SVGPatternElement::m_patternContentUnits>();
62
    });
66
    });
Lines 72-81 void SVGPatternElement::registerAttributes() a/Source/WebCore/svg/SVGPatternElement.cpp_sec2
72
    auto& registry = attributeRegistry();
76
    auto& registry = attributeRegistry();
73
    if (!registry.isEmpty())
77
    if (!registry.isEmpty())
74
        return;
78
        return;
75
    registry.registerAttribute<SVGNames::xAttr, &SVGPatternElement::m_x>();
76
    registry.registerAttribute<SVGNames::yAttr, &SVGPatternElement::m_y>();
77
    registry.registerAttribute<SVGNames::widthAttr, &SVGPatternElement::m_width>();
78
    registry.registerAttribute<SVGNames::heightAttr, &SVGPatternElement::m_height>();
79
    registry.registerAttribute<SVGNames::patternTransformAttr, &SVGPatternElement::m_patternTransform>();
79
    registry.registerAttribute<SVGNames::patternTransformAttr, &SVGPatternElement::m_patternTransform>();
80
}
80
}
81
81
Lines 104-116 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt a/Source/WebCore/svg/SVGPatternElement.cpp_sec3
104
    SVGParsingError parseError = NoError;
104
    SVGParsingError parseError = NoError;
105
105
106
    if (name == SVGNames::xAttr)
106
    if (name == SVGNames::xAttr)
107
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
107
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
108
    else if (name == SVGNames::yAttr)
108
    else if (name == SVGNames::yAttr)
109
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
109
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
110
    else if (name == SVGNames::widthAttr)
110
    else if (name == SVGNames::widthAttr)
111
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
111
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
112
    else if (name == SVGNames::heightAttr)
112
    else if (name == SVGNames::heightAttr)
113
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
113
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
114
114
115
    reportAttributeParsingError(parseError, name, value);
115
    reportAttributeParsingError(parseError, name, value);
116
116
Lines 123-129 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt a/Source/WebCore/svg/SVGPatternElement.cpp_sec4
123
123
124
void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
124
void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
125
{
125
{
126
    if (isAnimatedLengthAttribute(attrName)) {
126
    if (PropertyRegistry::isAnimatedLengthAttribute(attrName)) {
127
        InstanceInvalidationGuard guard(*this);
127
        InstanceInvalidationGuard guard(*this);
128
        invalidateSVGPresentationAttributeStyle();
128
        invalidateSVGPresentationAttributeStyle();
129
        return;
129
        return;
- a/Source/WebCore/svg/SVGPatternElement.h -14 / +12 lines
Lines 21-27 a/Source/WebCore/svg/SVGPatternElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGAnimatedTransformList.h"
24
#include "SVGAnimatedTransformList.h"
26
#include "SVGElement.h"
25
#include "SVGElement.h"
27
#include "SVGExternalResourcesRequired.h"
26
#include "SVGExternalResourcesRequired.h"
Lines 44-61 public: a/Source/WebCore/svg/SVGPatternElement.h_sec2
44
43
45
    AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const final;
44
    AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const final;
46
45
47
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
46
    const SVGLengthValue& x() const { return m_x->currentValue(); }
48
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
47
    const SVGLengthValue& y() const { return m_y->currentValue(); }
49
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
48
    const SVGLengthValue& width() const { return m_width->currentValue(); }
50
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
49
    const SVGLengthValue& height() const { return m_height->currentValue(); }
51
    SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
50
    SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
52
    SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
51
    SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits->currentValue<SVGUnitTypes::SVGUnitType>(); }
53
    const SVGTransformListValues& patternTransform() const { return m_patternTransform.currentValue(attributeOwnerProxy()); }
52
    const SVGTransformListValues& patternTransform() const { return m_patternTransform.currentValue(attributeOwnerProxy()); }
54
53
55
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
54
    SVGAnimatedLength& xAnimated() { return m_x; }
56
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
55
    SVGAnimatedLength& yAnimated() { return m_y; }
57
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
56
    SVGAnimatedLength& widthAnimated() { return m_width; }
58
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
57
    SVGAnimatedLength& heightAnimated() { return m_height; }
59
    SVGAnimatedEnumeration& patternUnitsAnimated() { return m_patternUnits; }
58
    SVGAnimatedEnumeration& patternUnitsAnimated() { return m_patternUnits; }
60
    SVGAnimatedEnumeration& patternContentUnitsAnimated() { return m_patternContentUnits; }
59
    SVGAnimatedEnumeration& patternContentUnitsAnimated() { return m_patternContentUnits; }
61
    RefPtr<SVGAnimatedTransformList> patternTransformAnimated() { return m_patternTransform.animatedProperty(attributeOwnerProxy()); }
60
    RefPtr<SVGAnimatedTransformList> patternTransformAnimated() { return m_patternTransform.animatedProperty(attributeOwnerProxy()); }
Lines 71-77 private: a/Source/WebCore/svg/SVGPatternElement.h_sec3
71
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGPatternElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGTests, SVGURIReference>;
70
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGPatternElement, SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGTests, SVGURIReference>;
72
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
71
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
73
72
74
    static bool isAnimatedLengthAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isAnimatedLengthAttribute(attributeName); }
75
    static bool isKnownAttribute(const QualifiedName& attributeName)
73
    static bool isKnownAttribute(const QualifiedName& attributeName)
76
    {
74
    {
77
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
75
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
Lines 89-98 private: a/Source/WebCore/svg/SVGPatternElement.h_sec4
89
87
90
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
88
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
91
    PropertyRegistry m_propertyRegistry { *this };
89
    PropertyRegistry m_propertyRegistry { *this };
92
    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
90
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) };
93
    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
91
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) };
94
    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
92
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth) };
95
    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
93
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight) };
96
    Ref<SVGAnimatedEnumeration> m_patternUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) };
94
    Ref<SVGAnimatedEnumeration> m_patternUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) };
97
    Ref<SVGAnimatedEnumeration> m_patternContentUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) };
95
    Ref<SVGAnimatedEnumeration> m_patternContentUnits { SVGAnimatedEnumeration::create(this, SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) };
98
    SVGAnimatedTransformListAttribute m_patternTransform;
96
    SVGAnimatedTransformListAttribute m_patternTransform;
- a/Source/WebCore/svg/SVGPoint.h +1 lines
Lines 28-33 a/Source/WebCore/svg/SVGPoint.h_sec1
28
28
29
#include "FloatPoint.h"
29
#include "FloatPoint.h"
30
#include "SVGMatrix.h"
30
#include "SVGMatrix.h"
31
#include "SVGPropertyTraits.h"
31
#include "SVGValueProperty.h"
32
#include "SVGValueProperty.h"
32
33
33
namespace WebCore {
34
namespace WebCore {
- a/Source/WebCore/svg/SVGRadialGradientElement.cpp -22 / +18 lines
Lines 4-10 a/Source/WebCore/svg/SVGRadialGradientElement.cpp_sec1
4
 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4
 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
5
 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5
 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
6
 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6
 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7
 * Copyright (C) 2018 Apple Inc. All rights reserved.
7
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
8
 *
8
 *
9
 * This library is free software; you can redistribute it and/or
9
 * This library is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU Library General Public
10
 * modify it under the terms of the GNU Library General Public
Lines 44-50 inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& t a/Source/WebCore/svg/SVGRadialGradientElement.cpp_sec2
44
{
44
{
45
    // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified.
45
    // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified.
46
    ASSERT(hasTagName(SVGNames::radialGradientTag));
46
    ASSERT(hasTagName(SVGNames::radialGradientTag));
47
    registerAttributes();
47
48
    static std::once_flag onceFlag;
49
    std::call_once(onceFlag, [] {
50
        PropertyRegistry::registerProperty<SVGNames::cxAttr, &SVGRadialGradientElement::m_cx>();
51
        PropertyRegistry::registerProperty<SVGNames::cyAttr, &SVGRadialGradientElement::m_cy>();
52
        PropertyRegistry::registerProperty<SVGNames::rAttr, &SVGRadialGradientElement::m_r>();
53
        PropertyRegistry::registerProperty<SVGNames::fxAttr, &SVGRadialGradientElement::m_fx>();
54
        PropertyRegistry::registerProperty<SVGNames::fyAttr, &SVGRadialGradientElement::m_fy>();
55
        PropertyRegistry::registerProperty<SVGNames::frAttr, &SVGRadialGradientElement::m_fr>();
56
    });
48
}
57
}
49
58
50
Ref<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedName& tagName, Document& document)
59
Ref<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedName& tagName, Document& document)
Lines 52-86 Ref<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedNa a/Source/WebCore/svg/SVGRadialGradientElement.cpp_sec3
52
    return adoptRef(*new SVGRadialGradientElement(tagName, document));
61
    return adoptRef(*new SVGRadialGradientElement(tagName, document));
53
}
62
}
54
63
55
void SVGRadialGradientElement::registerAttributes()
56
{
57
    auto& registry = attributeRegistry();
58
    if (!registry.isEmpty())
59
        return;
60
    registry.registerAttribute<SVGNames::cxAttr, &SVGRadialGradientElement::m_cx>();
61
    registry.registerAttribute<SVGNames::cyAttr, &SVGRadialGradientElement::m_cy>();
62
    registry.registerAttribute<SVGNames::rAttr, &SVGRadialGradientElement::m_r>();
63
    registry.registerAttribute<SVGNames::fxAttr, &SVGRadialGradientElement::m_fx>();
64
    registry.registerAttribute<SVGNames::fyAttr, &SVGRadialGradientElement::m_fy>();
65
    registry.registerAttribute<SVGNames::frAttr, &SVGRadialGradientElement::m_fr>();
66
}
67
68
void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
64
void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
69
{
65
{
70
    SVGParsingError parseError = NoError;
66
    SVGParsingError parseError = NoError;
71
67
72
    if (name == SVGNames::cxAttr)
68
    if (name == SVGNames::cxAttr)
73
        m_cx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
69
        m_cx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
74
    else if (name == SVGNames::cyAttr)
70
    else if (name == SVGNames::cyAttr)
75
        m_cy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
71
        m_cy->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
76
    else if (name == SVGNames::rAttr)
72
    else if (name == SVGNames::rAttr)
77
        m_r.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
73
        m_r->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
78
    else if (name == SVGNames::fxAttr)
74
    else if (name == SVGNames::fxAttr)
79
        m_fx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
75
        m_fx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
80
    else if (name == SVGNames::fyAttr)
76
    else if (name == SVGNames::fyAttr)
81
        m_fy.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
77
        m_fy->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
82
    else if (name == SVGNames::frAttr)
78
    else if (name == SVGNames::frAttr)
83
        m_fr.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
79
        m_fr->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
84
80
85
    reportAttributeParsingError(parseError, name, value);
81
    reportAttributeParsingError(parseError, name, value);
86
82
Lines 89-95 void SVGRadialGradientElement::parseAttribute(const QualifiedName& name, const A a/Source/WebCore/svg/SVGRadialGradientElement.cpp_sec4
89
85
90
void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName)
86
void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName)
91
{
87
{
92
    if (isKnownAttribute(attrName)) {
88
    if (PropertyRegistry::isKnownAttribute(attrName)) {
93
        InstanceInvalidationGuard guard(*this);
89
        InstanceInvalidationGuard guard(*this);
94
        updateRelativeLengthsInformation();
90
        updateRelativeLengthsInformation();
95
        if (RenderObject* object = renderer())
91
        if (RenderObject* object = renderer())
- a/Source/WebCore/svg/SVGRadialGradientElement.h -21 / +18 lines
Lines 21-27 a/Source/WebCore/svg/SVGRadialGradientElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGGradientElement.h"
24
#include "SVGGradientElement.h"
26
#include "SVGNames.h"
25
#include "SVGNames.h"
27
26
Lines 36-61 public: a/Source/WebCore/svg/SVGRadialGradientElement.h_sec2
36
35
37
    bool collectGradientAttributes(RadialGradientAttributes&);
36
    bool collectGradientAttributes(RadialGradientAttributes&);
38
37
39
    const SVGLengthValue& cx() const { return m_cx.currentValue(attributeOwnerProxy()); }
38
    const SVGLengthValue& cx() const { return m_cx->currentValue(); }
40
    const SVGLengthValue& cy() const { return m_cy.currentValue(attributeOwnerProxy()); }
39
    const SVGLengthValue& cy() const { return m_cy->currentValue(); }
41
    const SVGLengthValue& r() const { return m_r.currentValue(attributeOwnerProxy()); }
40
    const SVGLengthValue& r() const { return m_r->currentValue(); }
42
    const SVGLengthValue& fx() const { return m_fx.currentValue(attributeOwnerProxy()); }
41
    const SVGLengthValue& fx() const { return m_fx->currentValue(); }
43
    const SVGLengthValue& fy() const { return m_fy.currentValue(attributeOwnerProxy()); }
42
    const SVGLengthValue& fy() const { return m_fy->currentValue(); }
44
    const SVGLengthValue& fr() const { return m_fr.currentValue(attributeOwnerProxy()); }
43
    const SVGLengthValue& fr() const { return m_fr->currentValue(); }
45
44
46
    RefPtr<SVGAnimatedLength> cxAnimated() { return m_cx.animatedProperty(attributeOwnerProxy()); }
45
    SVGAnimatedLength& cxAnimated() { return m_cx; }
47
    RefPtr<SVGAnimatedLength> cyAnimated() { return m_cy.animatedProperty(attributeOwnerProxy()); }
46
    SVGAnimatedLength& cyAnimated() { return m_cy; }
48
    RefPtr<SVGAnimatedLength> rAnimated() { return m_r.animatedProperty(attributeOwnerProxy()); }
47
    SVGAnimatedLength& rAnimated() { return m_r; }
49
    RefPtr<SVGAnimatedLength> fxAnimated() { return m_fx.animatedProperty(attributeOwnerProxy()); }
48
    SVGAnimatedLength& fxAnimated() { return m_fx; }
50
    RefPtr<SVGAnimatedLength> fyAnimated() { return m_fy.animatedProperty(attributeOwnerProxy()); }
49
    SVGAnimatedLength& fyAnimated() { return m_fy; }
51
    RefPtr<SVGAnimatedLength> frAnimated() { return m_fr.animatedProperty(attributeOwnerProxy()); }
50
    SVGAnimatedLength& frAnimated() { return m_fr; }
52
51
53
private:
52
private:
54
    SVGRadialGradientElement(const QualifiedName&, Document&);
53
    SVGRadialGradientElement(const QualifiedName&, Document&);
55
54
56
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRadialGradientElement, SVGGradientElement>;
55
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRadialGradientElement, SVGGradientElement>;
57
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
58
    static void registerAttributes();
59
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
56
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
60
    
57
    
61
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGRadialGradientElement, SVGGradientElement>;
58
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGRadialGradientElement, SVGGradientElement>;
Lines 70-81 private: a/Source/WebCore/svg/SVGRadialGradientElement.h_sec3
70
67
71
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
68
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
72
    PropertyRegistry m_propertyRegistry { *this };
69
    PropertyRegistry m_propertyRegistry { *this };
73
    SVGAnimatedLengthAttribute m_cx { LengthModeWidth, "50%" };
70
    Ref<SVGAnimatedLength> m_cx { SVGAnimatedLength::create(this, LengthModeWidth, "50%") };
74
    SVGAnimatedLengthAttribute m_cy { LengthModeHeight, "50%" };
71
    Ref<SVGAnimatedLength> m_cy { SVGAnimatedLength::create(this, LengthModeHeight, "50%") };
75
    SVGAnimatedLengthAttribute m_r { LengthModeOther, "50%" };
72
    Ref<SVGAnimatedLength> m_r { SVGAnimatedLength::create(this, LengthModeOther, "50%") };
76
    SVGAnimatedLengthAttribute m_fx { LengthModeWidth };
73
    Ref<SVGAnimatedLength> m_fx { SVGAnimatedLength::create(this, LengthModeWidth) };
77
    SVGAnimatedLengthAttribute m_fy { LengthModeHeight };
74
    Ref<SVGAnimatedLength> m_fy { SVGAnimatedLength::create(this, LengthModeHeight) };
78
    SVGAnimatedLengthAttribute m_fr { LengthModeOther, "0%" };
75
    Ref<SVGAnimatedLength> m_fr { SVGAnimatedLength::create(this, LengthModeOther, "0%") };
79
};
76
};
80
77
81
} // namespace WebCore
78
} // namespace WebCore
- a/Source/WebCore/svg/SVGRectElement.cpp -22 / +18 lines
Lines 2-8 a/Source/WebCore/svg/SVGRectElement.cpp_sec1
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
4
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
5
 * Copyright (C) 2018 Apple Inc. All rights reserved.
5
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
6
 *
6
 *
7
 * This library is free software; you can redistribute it and/or
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Library General Public
8
 * modify it under the terms of the GNU Library General Public
Lines 36-42 inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& do a/Source/WebCore/svg/SVGRectElement.cpp_sec2
36
    , SVGExternalResourcesRequired(this)
36
    , SVGExternalResourcesRequired(this)
37
{
37
{
38
    ASSERT(hasTagName(SVGNames::rectTag));
38
    ASSERT(hasTagName(SVGNames::rectTag));
39
    registerAttributes();
39
40
    static std::once_flag onceFlag;
41
    std::call_once(onceFlag, [] {
42
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGRectElement::m_x>();
43
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGRectElement::m_y>();
44
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGRectElement::m_width>();
45
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGRectElement::m_height>();
46
        PropertyRegistry::registerProperty<SVGNames::rxAttr, &SVGRectElement::m_rx>();
47
        PropertyRegistry::registerProperty<SVGNames::ryAttr, &SVGRectElement::m_ry>();
48
    });
40
}
49
}
41
50
42
Ref<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Document& document)
51
Ref<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Document& document)
Lines 44-78 Ref<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Documen a/Source/WebCore/svg/SVGRectElement.cpp_sec3
44
    return adoptRef(*new SVGRectElement(tagName, document));
53
    return adoptRef(*new SVGRectElement(tagName, document));
45
}
54
}
46
55
47
void SVGRectElement::registerAttributes()
48
{
49
    auto& registry = attributeRegistry();
50
    if (!registry.isEmpty())
51
        return;
52
    registry.registerAttribute<SVGNames::xAttr, &SVGRectElement::m_x>();
53
    registry.registerAttribute<SVGNames::yAttr, &SVGRectElement::m_y>();
54
    registry.registerAttribute<SVGNames::widthAttr, &SVGRectElement::m_width>();
55
    registry.registerAttribute<SVGNames::heightAttr, &SVGRectElement::m_height>();
56
    registry.registerAttribute<SVGNames::rxAttr, &SVGRectElement::m_rx>();
57
    registry.registerAttribute<SVGNames::ryAttr, &SVGRectElement::m_ry>();
58
}
59
60
void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
56
void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
61
{
57
{
62
    SVGParsingError parseError = NoError;
58
    SVGParsingError parseError = NoError;
63
59
64
    if (name == SVGNames::xAttr)
60
    if (name == SVGNames::xAttr)
65
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
61
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
66
    else if (name == SVGNames::yAttr)
62
    else if (name == SVGNames::yAttr)
67
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
63
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
68
    else if (name == SVGNames::rxAttr)
64
    else if (name == SVGNames::rxAttr)
69
        m_rx.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
65
        m_rx->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
70
    else if (name == SVGNames::ryAttr)
66
    else if (name == SVGNames::ryAttr)
71
        m_ry.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
67
        m_ry->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
72
    else if (name == SVGNames::widthAttr)
68
    else if (name == SVGNames::widthAttr)
73
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
69
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
74
    else if (name == SVGNames::heightAttr)
70
    else if (name == SVGNames::heightAttr)
75
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
71
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
76
72
77
    reportAttributeParsingError(parseError, name, value);
73
    reportAttributeParsingError(parseError, name, value);
78
74
Lines 82-88 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin a/Source/WebCore/svg/SVGRectElement.cpp_sec4
82
78
83
void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
79
void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
84
{
80
{
85
    if (isKnownAttribute(attrName)) {
81
    if (PropertyRegistry::isKnownAttribute(attrName)) {
86
        InstanceInvalidationGuard guard(*this);
82
        InstanceInvalidationGuard guard(*this);
87
        invalidateSVGPresentationAttributeStyle();
83
        invalidateSVGPresentationAttributeStyle();
88
        return;
84
        return;
- a/Source/WebCore/svg/SVGRectElement.h -26 / +18 lines
Lines 21-27 a/Source/WebCore/svg/SVGRectElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGExternalResourcesRequired.h"
24
#include "SVGExternalResourcesRequired.h"
26
#include "SVGGeometryElement.h"
25
#include "SVGGeometryElement.h"
27
#include "SVGNames.h"
26
#include "SVGNames.h"
Lines 33-68 class SVGRectElement final : public SVGGeometryElement, public SVGExternalResour a/Source/WebCore/svg/SVGRectElement.h_sec2
33
public:
32
public:
34
    static Ref<SVGRectElement> create(const QualifiedName&, Document&);
33
    static Ref<SVGRectElement> create(const QualifiedName&, Document&);
35
34
36
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
35
    const SVGLengthValue& x() const { return m_x->currentValue(); }
37
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
36
    const SVGLengthValue& y() const { return m_y->currentValue(); }
38
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
37
    const SVGLengthValue& width() const { return m_width->currentValue(); }
39
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
38
    const SVGLengthValue& height() const { return m_height->currentValue(); }
40
    const SVGLengthValue& rx() const { return m_rx.currentValue(attributeOwnerProxy()); }
39
    const SVGLengthValue& rx() const { return m_rx->currentValue(); }
41
    const SVGLengthValue& ry() const { return m_ry.currentValue(attributeOwnerProxy()); }
40
    const SVGLengthValue& ry() const { return m_ry->currentValue(); }
42
41
43
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
42
    SVGAnimatedLength& xAnimated() { return m_x; }
44
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
43
    SVGAnimatedLength& yAnimated() { return m_y; }
45
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
44
    SVGAnimatedLength& widthAnimated() { return m_width; }
46
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
45
    SVGAnimatedLength& heightAnimated() { return m_height; }
47
    RefPtr<SVGAnimatedLength> rxAnimated() { return m_rx.animatedProperty(attributeOwnerProxy()); }
46
    SVGAnimatedLength& rxAnimated() { return m_rx; }
48
    RefPtr<SVGAnimatedLength> ryAnimated() { return m_ry.animatedProperty(attributeOwnerProxy()); }
47
    SVGAnimatedLength& ryAnimated() { return m_ry; }
49
48
50
private:
49
private:
51
    SVGRectElement(const QualifiedName&, Document&);
50
    SVGRectElement(const QualifiedName&, Document&);
52
51
53
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>;
52
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>;
54
    static auto& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
55
    static void registerAttributes();
56
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
53
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
57
54
58
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>;
55
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGRectElement, SVGGeometryElement, SVGExternalResourcesRequired>;
59
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
56
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
60
57
61
    static bool isKnownAttribute(const QualifiedName& attributeName)
62
    {
63
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
64
    }
65
66
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
58
    void parseAttribute(const QualifiedName&, const AtomicString&) final;
67
    void svgAttributeChanged(const QualifiedName&) final;
59
    void svgAttributeChanged(const QualifiedName&) final;
68
60
Lines 73-84 private: a/Source/WebCore/svg/SVGRectElement.h_sec3
73
65
74
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
66
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
75
    PropertyRegistry m_propertyRegistry { *this };
67
    PropertyRegistry m_propertyRegistry { *this };
76
    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
68
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) };
77
    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
69
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) };
78
    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
70
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth) };
79
    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
71
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight) };
80
    SVGAnimatedLengthAttribute m_rx { LengthModeWidth };
72
    Ref<SVGAnimatedLength> m_rx { SVGAnimatedLength::create(this, LengthModeWidth) };
81
    SVGAnimatedLengthAttribute m_ry { LengthModeHeight};
73
    Ref<SVGAnimatedLength> m_ry { SVGAnimatedLength::create(this, LengthModeHeight) };
82
};
74
};
83
75
84
} // namespace WebCore
76
} // namespace WebCore
- a/Source/WebCore/svg/SVGSVGElement.cpp -18 / +14 lines
Lines 1-7 a/Source/WebCore/svg/SVGSVGElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2007-2018 Apple Inc. All rights reserved.
4
 * Copyright (C) 2007-2019 Apple Inc. All rights reserved.
5
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
5
 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
6
 *
6
 *
7
 * This library is free software; you can redistribute it and/or
7
 * This library is free software; you can redistribute it and/or
Lines 58-65 inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& docu a/Source/WebCore/svg/SVGSVGElement.cpp_sec2
58
    , m_timeContainer(SMILTimeContainer::create(*this))
58
    , m_timeContainer(SMILTimeContainer::create(*this))
59
{
59
{
60
    ASSERT(hasTagName(SVGNames::svgTag));
60
    ASSERT(hasTagName(SVGNames::svgTag));
61
    registerAttributes();
62
    document.registerForDocumentSuspensionCallbacks(*this);
61
    document.registerForDocumentSuspensionCallbacks(*this);
62
63
    static std::once_flag onceFlag;
64
    std::call_once(onceFlag, [] {
65
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGSVGElement::m_x>();
66
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGSVGElement::m_y>();
67
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGSVGElement::m_width>();
68
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGSVGElement::m_height>();
69
    });
63
}
70
}
64
71
65
Ref<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document)
72
Ref<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document)
Lines 186-202 void SVGSVGElement::updateCurrentTranslate() a/Source/WebCore/svg/SVGSVGElement.cpp_sec3
186
        document().renderView()->repaint();
193
        document().renderView()->repaint();
187
}
194
}
188
195
189
void SVGSVGElement::registerAttributes()
190
{
191
    auto& registry = attributeRegistry();
192
    if (!registry.isEmpty())
193
        return;
194
    registry.registerAttribute<SVGNames::xAttr, &SVGSVGElement::m_x>();
195
    registry.registerAttribute<SVGNames::yAttr, &SVGSVGElement::m_y>();
196
    registry.registerAttribute<SVGNames::widthAttr, &SVGSVGElement::m_width>();
197
    registry.registerAttribute<SVGNames::heightAttr, &SVGSVGElement::m_height>();
198
}
199
200
void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
196
void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
201
{
197
{
202
    if (!nearestViewportElement()) {
198
    if (!nearestViewportElement()) {
Lines 235-243 void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString a/Source/WebCore/svg/SVGSVGElement.cpp_sec4
235
    SVGParsingError parseError = NoError;
231
    SVGParsingError parseError = NoError;
236
232
237
    if (name == SVGNames::xAttr)
233
    if (name == SVGNames::xAttr)
238
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
234
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
239
    else if (name == SVGNames::yAttr)
235
    else if (name == SVGNames::yAttr)
240
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
236
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
241
    else if (name == SVGNames::widthAttr) {
237
    else if (name == SVGNames::widthAttr) {
242
        auto length = SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths);
238
        auto length = SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths);
243
        if (parseError != NoError || value.isEmpty()) {
239
        if (parseError != NoError || value.isEmpty()) {
Lines 245-251 void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString a/Source/WebCore/svg/SVGSVGElement.cpp_sec5
245
            // Not sure it's correct for the empty string or for something that can't be parsed.
241
            // Not sure it's correct for the empty string or for something that can't be parsed.
246
            length = SVGLengthValue(LengthModeWidth, "100%"_s);
242
            length = SVGLengthValue(LengthModeWidth, "100%"_s);
247
        }
243
        }
248
        m_width.setValue(length);
244
        m_width->setBaseValInternal(length);
249
    } else if (name == SVGNames::heightAttr) {
245
    } else if (name == SVGNames::heightAttr) {
250
        auto length = SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths);
246
        auto length = SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths);
251
        if (parseError != NoError || value.isEmpty()) {
247
        if (parseError != NoError || value.isEmpty()) {
Lines 253-259 void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString a/Source/WebCore/svg/SVGSVGElement.cpp_sec6
253
            // Not sure it's correct for the empty string or for something that can't be parsed.
249
            // Not sure it's correct for the empty string or for something that can't be parsed.
254
            length = SVGLengthValue(LengthModeHeight, "100%"_s);
250
            length = SVGLengthValue(LengthModeHeight, "100%"_s);
255
        }
251
        }
256
        m_height.setValue(length);
252
        m_height->setBaseValInternal(length);
257
    }
253
    }
258
254
259
    reportAttributeParsingError(parseError, name, value);
255
    reportAttributeParsingError(parseError, name, value);
Lines 266-272 void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString a/Source/WebCore/svg/SVGSVGElement.cpp_sec7
266
262
267
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
263
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
268
{
264
{
269
    if (isKnownAttribute(attrName)) {
265
    if (PropertyRegistry::isKnownAttribute(attrName)) {
270
        InstanceInvalidationGuard guard(*this);
266
        InstanceInvalidationGuard guard(*this);
271
        invalidateSVGPresentationAttributeStyle();
267
        invalidateSVGPresentationAttributeStyle();
272
268
- a/Source/WebCore/svg/SVGSVGElement.h -20 / +12 lines
Lines 22-28 a/Source/WebCore/svg/SVGSVGElement.h_sec1
22
#pragma once
22
#pragma once
23
23
24
#include "FloatPoint.h"
24
#include "FloatPoint.h"
25
#include "SVGAnimatedLength.h"
26
#include "SVGExternalResourcesRequired.h"
25
#include "SVGExternalResourcesRequired.h"
27
#include "SVGFitToViewBox.h"
26
#include "SVGFitToViewBox.h"
28
#include "SVGGraphicsElement.h"
27
#include "SVGGraphicsElement.h"
Lines 118-150 public: a/Source/WebCore/svg/SVGSVGElement.h_sec2
118
117
119
    AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
118
    AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
120
119
121
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
120
    const SVGLengthValue& x() const { return m_x->currentValue(); }
122
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
121
    const SVGLengthValue& y() const { return m_y->currentValue(); }
123
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
122
    const SVGLengthValue& width() const { return m_width->currentValue(); }
124
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
123
    const SVGLengthValue& height() const { return m_height->currentValue(); }
125
124
126
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
125
    SVGAnimatedLength& xAnimated() { return m_x; }
127
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
126
    SVGAnimatedLength& yAnimated() { return m_y; }
128
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
127
    SVGAnimatedLength& widthAnimated() { return m_width; }
129
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
128
    SVGAnimatedLength& heightAnimated() { return m_height; }
130
129
131
private:
130
private:
132
    SVGSVGElement(const QualifiedName&, Document&);
131
    SVGSVGElement(const QualifiedName&, Document&);
133
    virtual ~SVGSVGElement();
132
    virtual ~SVGSVGElement();
134
133
135
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
134
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
136
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
137
    static void registerAttributes();
138
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
135
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
139
    
136
    
140
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
137
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGSVGElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGFitToViewBox>;
141
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
138
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
142
    
139
    
143
    static bool isKnownAttribute(const QualifiedName& attributeName)
144
    {
145
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
146
    }
147
148
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
140
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
149
    void svgAttributeChanged(const QualifiedName&) override;
141
    void svgAttributeChanged(const QualifiedName&) override;
150
    bool selfHasRelativeLengths() const override;
142
    bool selfHasRelativeLengths() const override;
Lines 176-185 private: a/Source/WebCore/svg/SVGSVGElement.h_sec3
176
168
177
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
169
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
178
    PropertyRegistry m_propertyRegistry { *this };
170
    PropertyRegistry m_propertyRegistry { *this };
179
    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
171
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) };
180
    SVGAnimatedLengthAttribute m_y { LengthModeHeight};
172
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) };
181
    SVGAnimatedLengthAttribute m_width { LengthModeWidth, "100%"_s };
173
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth, "100%"_s) };
182
    SVGAnimatedLengthAttribute m_height { LengthModeHeight, "100%"_s };
174
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight, "100%"_s) };
183
};
175
};
184
176
185
} // namespace WebCore
177
} // namespace WebCore
- a/Source/WebCore/svg/SVGTextContentElement.cpp -14 / +13 lines
Lines 1-7 a/Source/WebCore/svg/SVGTextContentElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
3
 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 47-56 SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Docum a/Source/WebCore/svg/SVGTextContentElement.cpp_sec2
47
    : SVGGraphicsElement(tagName, document)
47
    : SVGGraphicsElement(tagName, document)
48
    , SVGExternalResourcesRequired(this)
48
    , SVGExternalResourcesRequired(this)
49
{
49
{
50
    registerAttributes();
51
52
    static std::once_flag onceFlag;
50
    static std::once_flag onceFlag;
53
    std::call_once(onceFlag, [] {
51
    std::call_once(onceFlag, [] {
52
        PropertyRegistry::registerProperty<SVGNames::textLengthAttr, &SVGTextContentElement::m_textLength>();
54
        PropertyRegistry::registerProperty<SVGNames::lengthAdjustAttr, SVGLengthAdjustType, &SVGTextContentElement::m_lengthAdjust>();
53
        PropertyRegistry::registerProperty<SVGNames::lengthAdjustAttr, SVGLengthAdjustType, &SVGTextContentElement::m_lengthAdjust>();
55
    });
54
    });
56
}
55
}
Lines 163-176 void SVGTextContentElement::collectStyleForPresentationAttribute(const Qualified a/Source/WebCore/svg/SVGTextContentElement.cpp_sec3
163
    SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
162
    SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
164
}
163
}
165
164
166
void SVGTextContentElement::registerAttributes()
167
{
168
    auto& registry = attributeRegistry();
169
    if (!registry.isEmpty())
170
        return;
171
    registry.registerAttribute(SVGAnimatedCustomLengthAttributeAccessor::singleton<SVGNames::textLengthAttr, &SVGTextContentElement::m_textLength>());
172
}
173
174
void SVGTextContentElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
165
void SVGTextContentElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
175
{
166
{
176
    SVGParsingError parseError = NoError;
167
    SVGParsingError parseError = NoError;
Lines 180-186 void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom a/Source/WebCore/svg/SVGTextContentElement.cpp_sec4
180
        if (propertyValue > 0)
171
        if (propertyValue > 0)
181
            m_lengthAdjust->setBaseValInternal<SVGLengthAdjustType>(propertyValue);
172
            m_lengthAdjust->setBaseValInternal<SVGLengthAdjustType>(propertyValue);
182
    } else if (name == SVGNames::textLengthAttr)
173
    } else if (name == SVGNames::textLengthAttr)
183
        m_textLength.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
174
        m_textLength->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths));
184
175
185
    reportAttributeParsingError(parseError, name, value);
176
    reportAttributeParsingError(parseError, name, value);
186
177
Lines 190-198 void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom a/Source/WebCore/svg/SVGTextContentElement.cpp_sec5
190
181
191
void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName)
182
void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName)
192
{
183
{
193
    if (isKnownAttribute(attrName)) {
184
    if (PropertyRegistry::isKnownAttribute(attrName)) {
194
        if (attrName == SVGNames::textLengthAttr)
185
        if (attrName == SVGNames::textLengthAttr)
195
            m_specifiedTextLength = m_textLength.value();
186
            m_specifiedTextLength = m_textLength->baseVal()->value();
196
187
197
        if (auto renderer = this->renderer()) {
188
        if (auto renderer = this->renderer()) {
198
            InstanceInvalidationGuard guard(*this);
189
            InstanceInvalidationGuard guard(*this);
Lines 205-210 void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName) a/Source/WebCore/svg/SVGTextContentElement.cpp_sec6
205
    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
196
    SVGExternalResourcesRequired::svgAttributeChanged(attrName);
206
}
197
}
207
198
199
SVGAnimatedLength& SVGTextContentElement::textLengthAnimated()
200
{
201
    static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
202
    if (m_textLength->baseVal()->value() == defaultTextLength)
203
        m_textLength->baseVal()->value().newValueSpecifiedUnits(LengthTypeNumber, getComputedTextLength());
204
    return m_textLength;
205
}
206
208
bool SVGTextContentElement::selfHasRelativeLengths() const
207
bool SVGTextContentElement::selfHasRelativeLengths() const
209
{
208
{
210
    // Any element of the <text> subtree is advertized as using relative lengths.
209
    // Any element of the <text> subtree is advertized as using relative lengths.
- a/Source/WebCore/svg/SVGTextContentElement.h -46 / +4 lines
Lines 21-27 a/Source/WebCore/svg/SVGTextContentElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLength.h"
25
#include "SVGExternalResourcesRequired.h"
24
#include "SVGExternalResourcesRequired.h"
26
#include "SVGGraphicsElement.h"
25
#include "SVGGraphicsElement.h"
27
26
Lines 83-99 public: a/Source/WebCore/svg/SVGTextContentElement.h_sec2
83
    ExceptionOr<void> selectSubString(unsigned charnum, unsigned nchars);
82
    ExceptionOr<void> selectSubString(unsigned charnum, unsigned nchars);
84
83
85
    static SVGTextContentElement* elementFromRenderer(RenderObject*);
84
    static SVGTextContentElement* elementFromRenderer(RenderObject*);
86
    const SVGLengthValue& specifiedTextLength() { return m_specifiedTextLength; }
87
85
88
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
86
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
89
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
87
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
90
    
88
    
91
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
89
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextContentElement, SVGGraphicsElement, SVGExternalResourcesRequired>;
92
90
93
    const SVGLengthValue& textLength() const { return m_textLength.currentValue(attributeOwnerProxy()); }
91
    const SVGLengthValue& specifiedTextLength() const { return m_specifiedTextLength; }
92
    const SVGLengthValue& textLength() const { return m_textLength->currentValue(); }
94
    SVGLengthAdjustType lengthAdjust() const { return m_lengthAdjust->currentValue<SVGLengthAdjustType>(); }
93
    SVGLengthAdjustType lengthAdjust() const { return m_lengthAdjust->currentValue<SVGLengthAdjustType>(); }
95
94
96
    RefPtr<SVGAnimatedLength> textLengthAnimated() { return m_textLength.animatedProperty(attributeOwnerProxy()); }
95
    SVGAnimatedLength& textLengthAnimated();
97
    SVGAnimatedEnumeration& lengthAdjustAnimated() { return m_lengthAdjust; }
96
    SVGAnimatedEnumeration& lengthAdjustAnimated() { return m_lengthAdjust; }
98
97
99
protected:
98
protected:
Lines 112-163 private: a/Source/WebCore/svg/SVGTextContentElement.h_sec3
112
    bool isTextContent() const final { return true; }
111
    bool isTextContent() const final { return true; }
113
112
114
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
113
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
115
    static void registerAttributes();
116
117
    const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; }
114
    const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; }
118
115
119
    static bool isKnownAttribute(const QualifiedName& attributeName)
120
    {
121
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
122
    }
123
124
    class SVGAnimatedCustomLengthAttribute : public SVGAnimatedLengthAttribute {
125
    public:
126
        using SVGAnimatedLengthAttribute::operator=;
127
128
        SVGAnimatedCustomLengthAttribute(SVGTextContentElement& element, SVGLengthMode lengthMode)
129
            : SVGAnimatedLengthAttribute(lengthMode)
130
            , m_element(element)
131
        {
132
        }
133
134
        void synchronize(Element&, const QualifiedName& attributeName)
135
        {
136
            if (!shouldSynchronize())
137
                return;
138
            String string(SVGPropertyTraits<SVGLengthValue>::toString(m_element.m_specifiedTextLength));
139
            static_cast<Element&>(m_element).setSynchronizedLazyAttribute(attributeName, string);
140
        }
141
142
        RefPtr<SVGAnimatedLength> animatedProperty(const SVGAttributeOwnerProxy& attributeOwnerProxy)
143
        {
144
            static NeverDestroyed<SVGLengthValue> defaultTextLength(LengthModeOther);
145
            if (m_element.m_specifiedTextLength == defaultTextLength)
146
                m_element.m_textLength.value().newValueSpecifiedUnits(LengthTypeNumber, m_element.getComputedTextLength());
147
148
            setShouldSynchronize(true);
149
            return static_reference_cast<SVGAnimatedLength>(attributeOwnerProxy.lookupOrCreateAnimatedProperty(*this).releaseNonNull());
150
        }
151
152
    private:
153
        SVGTextContentElement& m_element;
154
    };
155
156
    using SVGAnimatedCustomLengthAttributeAccessor = SVGAnimatedAttributeAccessor<SVGTextContentElement, SVGAnimatedCustomLengthAttribute, AnimatedLength>;
157
158
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
116
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
159
    PropertyRegistry m_propertyRegistry { *this };
117
    PropertyRegistry m_propertyRegistry { *this };
160
    SVGAnimatedCustomLengthAttribute m_textLength { *this, LengthModeOther };
118
    Ref<SVGAnimatedLength> m_textLength { SVGAnimatedLength::create(this, LengthModeOther) };
161
    Ref<SVGAnimatedEnumeration> m_lengthAdjust { SVGAnimatedEnumeration::create(this, SVGLengthAdjustSpacing) };
119
    Ref<SVGAnimatedEnumeration> m_lengthAdjust { SVGAnimatedEnumeration::create(this, SVGLengthAdjustSpacing) };
162
    SVGLengthValue m_specifiedTextLength { LengthModeOther };
120
    SVGLengthValue m_specifiedTextLength { LengthModeOther };
163
};
121
};
- a/Source/WebCore/svg/SVGTextPathElement.cpp -12 / +4 lines
Lines 1-7 a/Source/WebCore/svg/SVGTextPathElement.cpp_sec1
1
/*
1
/*
2
 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
2
 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
3
 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com>
3
 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com>
4
 * Copyright (C) 2018 Apple Inc. All rights reserved.
4
 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
5
 *
5
 *
6
 * This library is free software; you can redistribute it and/or
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
7
 * modify it under the terms of the GNU Library General Public
Lines 38-47 inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Docu a/Source/WebCore/svg/SVGTextPathElement.cpp_sec2
38
    , SVGURIReference(this)
38
    , SVGURIReference(this)
39
{
39
{
40
    ASSERT(hasTagName(SVGNames::textPathTag));
40
    ASSERT(hasTagName(SVGNames::textPathTag));
41
    registerAttributes();
42
41
43
    static std::once_flag onceFlag;
42
    static std::once_flag onceFlag;
44
    std::call_once(onceFlag, [] {
43
    std::call_once(onceFlag, [] {
44
        PropertyRegistry::registerProperty<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>();
45
        PropertyRegistry::registerProperty<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>();
45
        PropertyRegistry::registerProperty<SVGNames::methodAttr, SVGTextPathMethodType, &SVGTextPathElement::m_method>();
46
        PropertyRegistry::registerProperty<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>();
46
        PropertyRegistry::registerProperty<SVGNames::spacingAttr, SVGTextPathSpacingType, &SVGTextPathElement::m_spacing>();
47
    });
47
    });
Lines 62-81 void SVGTextPathElement::clearResourceReferences() a/Source/WebCore/svg/SVGTextPathElement.cpp_sec3
62
    document().accessSVGExtensions().removeAllTargetReferencesForElement(*this);
62
    document().accessSVGExtensions().removeAllTargetReferencesForElement(*this);
63
}
63
}
64
64
65
void SVGTextPathElement::registerAttributes()
66
{
67
    auto& registry = attributeRegistry();
68
    if (!registry.isEmpty())
69
        return;
70
    registry.registerAttribute<SVGNames::startOffsetAttr, &SVGTextPathElement::m_startOffset>();
71
}
72
73
void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
65
void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
74
{
66
{
75
    SVGParsingError parseError = NoError;
67
    SVGParsingError parseError = NoError;
76
68
77
    if (name == SVGNames::startOffsetAttr)
69
    if (name == SVGNames::startOffsetAttr)
78
        m_startOffset.setValue(SVGLengthValue::construct(LengthModeOther, value, parseError));
70
        m_startOffset->setBaseValInternal(SVGLengthValue::construct(LengthModeOther, value, parseError));
79
    else if (name == SVGNames::methodAttr) {
71
    else if (name == SVGNames::methodAttr) {
80
        SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value);
72
        SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value);
81
        if (propertyValue > 0)
73
        if (propertyValue > 0)
Lines 94-100 void SVGTextPathElement::parseAttribute(const QualifiedName& name, const AtomicS a/Source/WebCore/svg/SVGTextPathElement.cpp_sec4
94
86
95
void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName)
87
void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName)
96
{
88
{
97
    if (isKnownAttribute(attrName)) {
89
    if (PropertyRegistry::isKnownAttribute(attrName)) {
98
        InstanceInvalidationGuard guard(*this);
90
        InstanceInvalidationGuard guard(*this);
99
91
100
        if (attrName == SVGNames::startOffsetAttr)
92
        if (attrName == SVGNames::startOffsetAttr)
- a/Source/WebCore/svg/SVGTextPathElement.h -10 / +3 lines
Lines 111-121 public: a/Source/WebCore/svg/SVGTextPathElement.h_sec1
111
111
112
    static Ref<SVGTextPathElement> create(const QualifiedName&, Document&);
112
    static Ref<SVGTextPathElement> create(const QualifiedName&, Document&);
113
113
114
    const SVGLengthValue& startOffset() const { return m_startOffset.currentValue(attributeOwnerProxy()); }
114
    const SVGLengthValue& startOffset() const { return m_startOffset->currentValue(); }
115
    SVGTextPathMethodType method() const { return m_method->currentValue<SVGTextPathMethodType>(); }
115
    SVGTextPathMethodType method() const { return m_method->currentValue<SVGTextPathMethodType>(); }
116
    SVGTextPathSpacingType spacing() const { return m_spacing->currentValue<SVGTextPathSpacingType>(); }
116
    SVGTextPathSpacingType spacing() const { return m_spacing->currentValue<SVGTextPathSpacingType>(); }
117
117
118
    RefPtr<SVGAnimatedLength> startOffsetAnimated() { return m_startOffset.animatedProperty(attributeOwnerProxy()); }
118
    SVGAnimatedLength& startOffsetAnimated() { return m_startOffset; }
119
    SVGAnimatedEnumeration& methodAnimated() { return m_method; }
119
    SVGAnimatedEnumeration& methodAnimated() { return m_method; }
120
    SVGAnimatedEnumeration& spacingAnimated() { return m_spacing; }
120
    SVGAnimatedEnumeration& spacingAnimated() { return m_spacing; }
121
121
Lines 127-144 private: a/Source/WebCore/svg/SVGTextPathElement.h_sec2
127
    virtual ~SVGTextPathElement();
127
    virtual ~SVGTextPathElement();
128
128
129
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>;
129
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTextPathElement, SVGTextContentElement, SVGURIReference>;
130
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
131
    static void registerAttributes();
132
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
130
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
133
131
134
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextPathElement, SVGTextContentElement, SVGURIReference>;
132
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextPathElement, SVGTextContentElement, SVGURIReference>;
135
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
133
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
136
134
137
    static bool isKnownAttribute(const QualifiedName& attributeName)
138
    {
139
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
140
    }
141
142
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
135
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
143
    void svgAttributeChanged(const QualifiedName&) override;
136
    void svgAttributeChanged(const QualifiedName&) override;
144
137
Lines 155-161 private: a/Source/WebCore/svg/SVGTextPathElement.h_sec3
155
148
156
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
149
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
157
    PropertyRegistry m_propertyRegistry { *this };
150
    PropertyRegistry m_propertyRegistry { *this };
158
    SVGAnimatedLengthAttribute m_startOffset { LengthModeOther };
151
    Ref<SVGAnimatedLength> m_startOffset { SVGAnimatedLength::create(this, LengthModeOther) };
159
    Ref<SVGAnimatedEnumeration> m_method { SVGAnimatedEnumeration::create(this, SVGTextPathMethodAlign) };
152
    Ref<SVGAnimatedEnumeration> m_method { SVGAnimatedEnumeration::create(this, SVGTextPathMethodAlign) };
160
    Ref<SVGAnimatedEnumeration> m_spacing { SVGAnimatedEnumeration::create(this, SVGTextPathSpacingExact) };
153
    Ref<SVGAnimatedEnumeration> m_spacing { SVGAnimatedEnumeration::create(this, SVGTextPathSpacingExact) };
161
};
154
};
- a/Source/WebCore/svg/SVGTextPositioningElement.cpp -31 / +9 lines
Lines 27-33 a/Source/WebCore/svg/SVGTextPositioningElement.cpp_sec1
27
#include "RenderSVGResource.h"
27
#include "RenderSVGResource.h"
28
#include "RenderSVGText.h"
28
#include "RenderSVGText.h"
29
#include "SVGAltGlyphElement.h"
29
#include "SVGAltGlyphElement.h"
30
#include "SVGLengthListValues.h"
31
#include "SVGNames.h"
30
#include "SVGNames.h"
32
#include "SVGTRefElement.h"
31
#include "SVGTRefElement.h"
33
#include "SVGTSpanElement.h"
32
#include "SVGTSpanElement.h"
Lines 41-96 WTF_MAKE_ISO_ALLOCATED_IMPL(SVGTextPositioningElement); a/Source/WebCore/svg/SVGTextPositioningElement.cpp_sec2
41
SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document& document)
40
SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document& document)
42
    : SVGTextContentElement(tagName, document)
41
    : SVGTextContentElement(tagName, document)
43
{
42
{
44
    registerAttributes();
45
    
46
    static std::once_flag onceFlag;
43
    static std::once_flag onceFlag;
47
    std::call_once(onceFlag, [] {
44
    std::call_once(onceFlag, [] {
45
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGTextPositioningElement::m_x>();
46
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGTextPositioningElement::m_y>();
47
        PropertyRegistry::registerProperty<SVGNames::dxAttr, &SVGTextPositioningElement::m_dx>();
48
        PropertyRegistry::registerProperty<SVGNames::dyAttr, &SVGTextPositioningElement::m_dy>();
48
        PropertyRegistry::registerProperty<SVGNames::rotateAttr, &SVGTextPositioningElement::m_rotate>();
49
        PropertyRegistry::registerProperty<SVGNames::rotateAttr, &SVGTextPositioningElement::m_rotate>();
49
    });
50
    });
50
}
51
}
51
52
52
void SVGTextPositioningElement::registerAttributes()
53
{
54
    auto& registry = attributeRegistry();
55
    if (!registry.isEmpty())
56
        return;
57
    registry.registerAttribute<SVGNames::xAttr, &SVGTextPositioningElement::m_x>();
58
    registry.registerAttribute<SVGNames::yAttr, &SVGTextPositioningElement::m_y>();
59
    registry.registerAttribute<SVGNames::dxAttr, &SVGTextPositioningElement::m_dx>();
60
    registry.registerAttribute<SVGNames::dyAttr, &SVGTextPositioningElement::m_dy>();
61
}
62
63
void SVGTextPositioningElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
53
void SVGTextPositioningElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
64
{
54
{
65
    if (name == SVGNames::xAttr) {
55
    if (name == SVGNames::xAttr) {
66
        SVGLengthListValues newList;
56
        m_x->baseVal()->parse(value);
67
        newList.parse(value, LengthModeWidth);
68
        m_x.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
69
        m_x.setValue(WTFMove(newList));
70
        return;
57
        return;
71
    }
58
    }
72
59
73
    if (name == SVGNames::yAttr) {
60
    if (name == SVGNames::yAttr) {
74
        SVGLengthListValues newList;
61
        m_y->baseVal()->parse(value);
75
        newList.parse(value, LengthModeHeight);
76
        m_y.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
77
        m_y.setValue(WTFMove(newList));
78
        return;
62
        return;
79
    }
63
    }
80
64
81
    if (name == SVGNames::dxAttr) {
65
    if (name == SVGNames::dxAttr) {
82
        SVGLengthListValues newList;
66
        m_dx->baseVal()->parse(value);
83
        newList.parse(value, LengthModeWidth);
84
        m_dx.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
85
        m_dx.setValue(WTFMove(newList));
86
        return;
67
        return;
87
    }
68
    }
88
69
89
    if (name == SVGNames::dyAttr) {
70
    if (name == SVGNames::dyAttr) {
90
        SVGLengthListValues newList;
71
        m_dy->baseVal()->parse(value);
91
        newList.parse(value, LengthModeHeight);
92
        m_dy.detachAnimatedListWrappers(attributeOwnerProxy(), newList.size());
93
        m_dy.setValue(WTFMove(newList));
94
        return;
72
        return;
95
    }
73
    }
96
74
Lines 118-124 bool SVGTextPositioningElement::isPresentationAttribute(const QualifiedName& nam a/Source/WebCore/svg/SVGTextPositioningElement.cpp_sec3
118
96
119
void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName)
97
void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrName)
120
{
98
{
121
    if (isKnownAttribute(attrName)) {
99
    if (PropertyRegistry::isKnownAttribute(attrName)) {
122
        InstanceInvalidationGuard guard(*this);
100
        InstanceInvalidationGuard guard(*this);
123
101
124
        if (attrName != SVGNames::rotateAttr)
102
        if (attrName != SVGNames::rotateAttr)
- a/Source/WebCore/svg/SVGTextPositioningElement.h -20 / +12 lines
Lines 21-27 a/Source/WebCore/svg/SVGTextPositioningElement.h_sec1
21
21
22
#pragma once
22
#pragma once
23
23
24
#include "SVGAnimatedLengthList.h"
25
#include "SVGTextContentElement.h"
24
#include "SVGTextContentElement.h"
26
25
27
namespace WebCore {
26
namespace WebCore {
Lines 36-51 public: a/Source/WebCore/svg/SVGTextPositioningElement.h_sec2
36
    
35
    
37
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextPositioningElement, SVGTextContentElement>;
36
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextPositioningElement, SVGTextContentElement>;
38
37
39
    const SVGLengthListValues& x() const { return m_x.currentValue(attributeOwnerProxy()); }
38
    const SVGLengthList& x() const { return m_x->currentValue(); }
40
    const SVGLengthListValues& y() const { return m_y.currentValue(attributeOwnerProxy()); }
39
    const SVGLengthList& y() const { return m_y->currentValue(); }
41
    const SVGLengthListValues& dx() const { return m_dx.currentValue(attributeOwnerProxy()); }
40
    const SVGLengthList& dx() const { return m_dx->currentValue(); }
42
    const SVGLengthListValues& dy() const { return m_dy.currentValue(attributeOwnerProxy()); }
41
    const SVGLengthList& dy() const { return m_dy->currentValue(); }
43
    const SVGNumberList& rotate() const { return m_rotate->currentValue(); }
42
    const SVGNumberList& rotate() const { return m_rotate->currentValue(); }
44
43
45
    RefPtr<SVGAnimatedLengthList> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
44
    SVGAnimatedLengthList& xAnimated() { return m_x; }
46
    RefPtr<SVGAnimatedLengthList> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
45
    SVGAnimatedLengthList& yAnimated() { return m_y; }
47
    RefPtr<SVGAnimatedLengthList> dxAnimated() { return m_dx.animatedProperty(attributeOwnerProxy()); }
46
    SVGAnimatedLengthList& dxAnimated() { return m_dx; }
48
    RefPtr<SVGAnimatedLengthList> dyAnimated() { return m_dy.animatedProperty(attributeOwnerProxy()); }
47
    SVGAnimatedLengthList& dyAnimated() { return m_dy; }
49
    SVGAnimatedNumberList& rotateAnimated() { return m_rotate; }
48
    SVGAnimatedNumberList& rotateAnimated() { return m_rotate; }
50
49
51
protected:
50
protected:
Lines 59-79 private: a/Source/WebCore/svg/SVGTextPositioningElement.h_sec3
59
    void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final;
58
    void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final;
60
59
61
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
60
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const override { return m_attributeOwnerProxy; }
62
    static void registerAttributes();
63
64
    const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; }
61
    const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; }
65
62
66
    static bool isKnownAttribute(const QualifiedName& attributeName)
67
    {
68
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
69
    }
70
71
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
63
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
72
    PropertyRegistry m_propertyRegistry { *this };
64
    PropertyRegistry m_propertyRegistry { *this };
73
    SVGAnimatedLengthListAttribute m_x;
65
    Ref<SVGAnimatedLengthList> m_x { SVGAnimatedLengthList::create(this, LengthModeWidth) };
74
    SVGAnimatedLengthListAttribute m_y;
66
    Ref<SVGAnimatedLengthList> m_y { SVGAnimatedLengthList::create(this, LengthModeHeight) };
75
    SVGAnimatedLengthListAttribute m_dx;
67
    Ref<SVGAnimatedLengthList> m_dx { SVGAnimatedLengthList::create(this, LengthModeWidth) };
76
    SVGAnimatedLengthListAttribute m_dy;
68
    Ref<SVGAnimatedLengthList> m_dy { SVGAnimatedLengthList::create(this, LengthModeHeight) };
77
    Ref<SVGAnimatedNumberList> m_rotate { SVGAnimatedNumberList::create(this) };
69
    Ref<SVGAnimatedNumberList> m_rotate { SVGAnimatedNumberList::create(this) };
78
};
70
};
79
71
- a/Source/WebCore/svg/SVGUseElement.cpp -18 / +14 lines
Lines 5-11 a/Source/WebCore/svg/SVGUseElement.cpp_sec1
5
 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5
 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6
 * Copyright (C) 2012 University of Szeged
6
 * Copyright (C) 2012 University of Szeged
7
 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
7
 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8
 * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
8
 * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
9
 *
9
 *
10
 * This library is free software; you can redistribute it and/or
10
 * This library is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU Library General Public
11
 * modify it under the terms of the GNU Library General Public
Lines 54-60 inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& docu a/Source/WebCore/svg/SVGUseElement.cpp_sec2
54
{
54
{
55
    ASSERT(hasCustomStyleResolveCallbacks());
55
    ASSERT(hasCustomStyleResolveCallbacks());
56
    ASSERT(hasTagName(SVGNames::useTag));
56
    ASSERT(hasTagName(SVGNames::useTag));
57
    registerAttributes();
57
58
    static std::once_flag onceFlag;
59
    std::call_once(onceFlag, [] {
60
        PropertyRegistry::registerProperty<SVGNames::xAttr, &SVGUseElement::m_x>();
61
        PropertyRegistry::registerProperty<SVGNames::yAttr, &SVGUseElement::m_y>();
62
        PropertyRegistry::registerProperty<SVGNames::widthAttr, &SVGUseElement::m_width>();
63
        PropertyRegistry::registerProperty<SVGNames::heightAttr, &SVGUseElement::m_height>();
64
    });
58
}
65
}
59
66
60
Ref<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Document& document)
67
Ref<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Document& document)
Lines 68-96 SVGUseElement::~SVGUseElement() a/Source/WebCore/svg/SVGUseElement.cpp_sec3
68
        m_externalDocument->removeClient(*this);
75
        m_externalDocument->removeClient(*this);
69
}
76
}
70
77
71
void SVGUseElement::registerAttributes()
72
{
73
    auto& registry = attributeRegistry();
74
    if (!registry.isEmpty())
75
        return;
76
    registry.registerAttribute<SVGNames::xAttr, &SVGUseElement::m_x>();
77
    registry.registerAttribute<SVGNames::yAttr, &SVGUseElement::m_y>();
78
    registry.registerAttribute<SVGNames::widthAttr, &SVGUseElement::m_width>();
79
    registry.registerAttribute<SVGNames::heightAttr, &SVGUseElement::m_height>();
80
}
81
82
void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
78
void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
83
{
79
{
84
    SVGParsingError parseError = NoError;
80
    SVGParsingError parseError = NoError;
85
81
86
    if (name == SVGNames::xAttr)
82
    if (name == SVGNames::xAttr)
87
        m_x.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
83
        m_x->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError));
88
    else if (name == SVGNames::yAttr)
84
    else if (name == SVGNames::yAttr)
89
        m_y.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
85
        m_y->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError));
90
    else if (name == SVGNames::widthAttr)
86
    else if (name == SVGNames::widthAttr)
91
        m_width.setValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
87
        m_width->setBaseValInternal(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths));
92
    else if (name == SVGNames::heightAttr)
88
    else if (name == SVGNames::heightAttr)
93
        m_height.setValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
89
        m_height->setBaseValInternal(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths));
94
90
95
    reportAttributeParsingError(parseError, name, value);
91
    reportAttributeParsingError(parseError, name, value);
96
92
Lines 163-169 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) a/Source/WebCore/svg/SVGUseElement.cpp_sec4
163
{
159
{
164
    InstanceInvalidationGuard guard(*this);
160
    InstanceInvalidationGuard guard(*this);
165
161
166
    if (isKnownAttribute(attrName)) {
162
    if (PropertyRegistry::isKnownAttribute(attrName)) {
167
        updateRelativeLengthsInformation();
163
        updateRelativeLengthsInformation();
168
        if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
164
        if (attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) {
169
            // FIXME: It's unnecessarily inefficient to update both width and height each time either is changed.
165
            // FIXME: It's unnecessarily inefficient to update both width and height each time either is changed.
- a/Source/WebCore/svg/SVGUseElement.h -20 / +12 lines
Lines 23-29 a/Source/WebCore/svg/SVGUseElement.h_sec1
23
23
24
#include "CachedResourceHandle.h"
24
#include "CachedResourceHandle.h"
25
#include "CachedSVGDocumentClient.h"
25
#include "CachedSVGDocumentClient.h"
26
#include "SVGAnimatedLength.h"
27
#include "SVGExternalResourcesRequired.h"
26
#include "SVGExternalResourcesRequired.h"
28
#include "SVGGraphicsElement.h"
27
#include "SVGGraphicsElement.h"
29
#include "SVGURIReference.h"
28
#include "SVGURIReference.h"
Lines 45-59 public: a/Source/WebCore/svg/SVGUseElement.h_sec2
45
44
46
    RenderElement* rendererClipChild() const;
45
    RenderElement* rendererClipChild() const;
47
46
48
    const SVGLengthValue& x() const { return m_x.currentValue(attributeOwnerProxy()); }
47
    const SVGLengthValue& x() const { return m_x->currentValue(); }
49
    const SVGLengthValue& y() const { return m_y.currentValue(attributeOwnerProxy()); }
48
    const SVGLengthValue& y() const { return m_y->currentValue(); }
50
    const SVGLengthValue& width() const { return m_width.currentValue(attributeOwnerProxy()); }
49
    const SVGLengthValue& width() const { return m_width->currentValue(); }
51
    const SVGLengthValue& height() const { return m_height.currentValue(attributeOwnerProxy()); }
50
    const SVGLengthValue& height() const { return m_height->currentValue(); }
52
51
53
    RefPtr<SVGAnimatedLength> xAnimated() { return m_x.animatedProperty(attributeOwnerProxy()); }
52
    SVGAnimatedLength& xAnimated() { return m_x; }
54
    RefPtr<SVGAnimatedLength> yAnimated() { return m_y.animatedProperty(attributeOwnerProxy()); }
53
    SVGAnimatedLength& yAnimated() { return m_y; }
55
    RefPtr<SVGAnimatedLength> widthAnimated() { return m_width.animatedProperty(attributeOwnerProxy()); }
54
    SVGAnimatedLength& widthAnimated() { return m_width; }
56
    RefPtr<SVGAnimatedLength> heightAnimated() { return m_height.animatedProperty(attributeOwnerProxy()); }
55
    SVGAnimatedLength& heightAnimated() { return m_height; }
57
56
58
private:
57
private:
59
    SVGUseElement(const QualifiedName&, Document&);
58
    SVGUseElement(const QualifiedName&, Document&);
Lines 65-82 private: a/Source/WebCore/svg/SVGUseElement.h_sec3
65
    void buildPendingResource() override;
64
    void buildPendingResource() override;
66
65
67
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
66
    using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
68
    static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
69
    static void registerAttributes();
70
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
67
    const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
71
68
72
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
69
    using PropertyRegistry = SVGPropertyOwnerRegistry<SVGUseElement, SVGGraphicsElement, SVGExternalResourcesRequired, SVGURIReference>;
73
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
70
    const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
74
71
75
    static bool isKnownAttribute(const QualifiedName& attributeName)
76
    {
77
        return AttributeOwnerProxy::isKnownAttribute(attributeName) || PropertyRegistry::isKnownAttribute(attributeName);
78
    }
79
80
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
72
    void parseAttribute(const QualifiedName&, const AtomicString&) override;
81
    void svgAttributeChanged(const QualifiedName&) override;
73
    void svgAttributeChanged(const QualifiedName&) override;
82
74
Lines 108-117 private: a/Source/WebCore/svg/SVGUseElement.h_sec4
108
100
109
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
101
    AttributeOwnerProxy m_attributeOwnerProxy { *this };
110
    PropertyRegistry m_propertyRegistry { *this };
102
    PropertyRegistry m_propertyRegistry { *this };
111
    SVGAnimatedLengthAttribute m_x { LengthModeWidth };
103
    Ref<SVGAnimatedLength> m_x { SVGAnimatedLength::create(this, LengthModeWidth) };
112
    SVGAnimatedLengthAttribute m_y { LengthModeHeight };
104
    Ref<SVGAnimatedLength> m_y { SVGAnimatedLength::create(this, LengthModeHeight) };
113
    SVGAnimatedLengthAttribute m_width { LengthModeWidth };
105
    Ref<SVGAnimatedLength> m_width { SVGAnimatedLength::create(this, LengthModeWidth) };
114
    SVGAnimatedLengthAttribute m_height { LengthModeHeight };
106
    Ref<SVGAnimatedLength> m_height { SVGAnimatedLength::create(this, LengthModeHeight) };
115
107
116
    bool m_haveFiredLoadEvent { false };
108
    bool m_haveFiredLoadEvent { false };
117
    bool m_shadowTreeNeedsUpdate { true };
109
    bool m_shadowTreeNeedsUpdate { true };
- a/Source/WebCore/svg/SVGValue.h -4 lines
Lines 25-32 a/Source/WebCore/svg/SVGValue.h_sec1
25
25
26
#pragma once
26
#pragma once
27
27
28
#include "SVGLengthListValues.h"
29
#include "SVGLengthValue.h"
30
#include "SVGPathByteStream.h"
28
#include "SVGPathByteStream.h"
31
#include "SVGTransformListValues.h"
29
#include "SVGTransformListValues.h"
32
30
Lines 35-42 a/Source/WebCore/svg/SVGValue.h_sec2
35
namespace WebCore {
33
namespace WebCore {
36
34
37
using SVGValueVariant = Variant<
35
using SVGValueVariant = Variant<
38
    SVGLengthValue*,
39
    SVGLengthListValues*,
40
    SVGPathByteStream*,
36
    SVGPathByteStream*,
41
    SVGTransformListValues*
37
    SVGTransformListValues*
42
>;
38
>;
- a/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h +47 lines
Lines 108-113 private: a/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h_sec1
108
    }
108
    }
109
};
109
};
110
110
111
template<typename OwnerType>
112
class SVGAnimatedLengthAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLength> {
113
    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLength>;
114
    using Base::property;
115
116
public:
117
    using Base::Base;
118
    template<Ref<SVGAnimatedLength> OwnerType::*property>
119
    constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedLengthAccessor, property>(); }
120
121
private:
122
    bool isAnimatedLength() const override { return true; }
123
124
    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
125
    {
126
        SVGLengthMode lengthMode = property(owner)->baseVal()->value().unitMode();
127
        return SVGAnimatedLengthAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
128
    }
129
130
    void appendAnimatedInstance(OwnerType& owner, SVGAttributeAnimator& animator) const final
131
    {
132
        static_cast<SVGAnimatedLengthAnimator&>(animator).appendAnimatedInstance(property(owner));
133
    }
134
};
135
136
template<typename OwnerType>
137
class SVGAnimatedLengthListAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLengthList> {
138
    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedLengthList>;
139
    using Base::property;
140
141
public:
142
    using Base::Base;
143
    template<Ref<SVGAnimatedLengthList> OwnerType::*property>
144
    constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedLengthListAccessor, property>(); }
145
146
private:
147
    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
148
    {
149
        return SVGAnimatedLengthListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, LengthModeWidth);
150
    }
151
152
    void appendAnimatedInstance(OwnerType& owner, SVGAttributeAnimator& animator) const final
153
    {
154
        static_cast<SVGAnimatedLengthListAnimator&>(animator).appendAnimatedInstance(property(owner));
155
    }
156
};
157
111
template<typename OwnerType>
158
template<typename OwnerType>
112
class SVGAnimatedNumberAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumber> {
159
class SVGAnimatedNumberAccessor final : public SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumber> {
113
    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumber>;
160
    using Base = SVGAnimatedPropertyAccessor<OwnerType, SVGAnimatedNumber>;
- a/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h +4 lines
Lines 75-80 public: a/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h_sec1
75
75
76
    void apply(SVGElement* targetElement) override
76
    void apply(SVGElement* targetElement) override
77
    {
77
    {
78
        if (isAnimatedStylePropertyAniamtor(targetElement))
79
            applyAnimatedStylePropertyChange(targetElement, m_animated->animValAsString());
78
        applyAnimatedPropertyChange(targetElement);
80
        applyAnimatedPropertyChange(targetElement);
79
    }
81
    }
80
82
Lines 88-93 public: a/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h_sec2
88
            instance->instanceStopAnimation();
90
            instance->instanceStopAnimation();
89
91
90
        applyAnimatedPropertyChange(targetElement);
92
        applyAnimatedPropertyChange(targetElement);
93
        if (isAnimatedStylePropertyAniamtor(targetElement))
94
            removeAnimatedStyleProperty(targetElement);
91
    }
95
    }
92
96
93
    float calculateDistance(SVGElement* targetElement, const String& from, const String& to) const override
97
    float calculateDistance(SVGElement* targetElement, const String& from, const String& to) const override
- a/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h +42 lines
Lines 120-125 private: a/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h_sec1
120
    }
120
    }
121
};
121
};
122
122
123
class SVGAnimatedLengthAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedLength, SVGAnimationLengthFunction> {
124
    using Base = SVGAnimatedPropertyAnimator<SVGAnimatedLength, SVGAnimationLengthFunction>;
125
126
public:
127
    SVGAnimatedLengthAnimator(const QualifiedName& attributeName, Ref<SVGAnimatedLength>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
128
        : Base(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode)
129
    {
130
    }
131
132
    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLength>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
133
    {
134
        return std::make_unique<SVGAnimatedLengthAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
135
    }
136
137
private:
138
    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) final
139
    {
140
        m_function.progress(targetElement, percentage, repeatCount, m_animated->animVal()->value());
141
    }
142
};
143
144
class SVGAnimatedLengthListAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedLengthList, SVGAnimationLengthListFunction> {
145
    using Base = SVGAnimatedPropertyAnimator<SVGAnimatedLengthList, SVGAnimationLengthListFunction>;
146
147
public:
148
    SVGAnimatedLengthListAnimator(const QualifiedName& attributeName, Ref<SVGAnimatedLengthList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
149
        : Base(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode)
150
    {
151
    }
152
153
    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLengthList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
154
    {
155
        return std::make_unique<SVGAnimatedLengthListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
156
    }
157
158
private:
159
    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) final
160
    {
161
        m_function.progress(targetElement, percentage, repeatCount, m_animated->animVal());
162
    }
163
};
164
123
class SVGAnimatedNumberAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedNumber, SVGAnimationNumberFunction> {
165
class SVGAnimatedNumberAnimator final : public SVGAnimatedPropertyAnimator<SVGAnimatedNumber, SVGAnimationNumberFunction> {
124
    friend class SVGAnimatedPropertyPairAnimator<SVGAnimatedNumberAnimator, SVGAnimatedNumberAnimator>;
166
    friend class SVGAnimatedPropertyPairAnimator<SVGAnimatedNumberAnimator, SVGAnimatedNumberAnimator>;
125
    friend class SVGAnimatedNumberPairAnimator;
167
    friend class SVGAnimatedNumberPairAnimator;
- a/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h -2 / +4 lines
Lines 27-39 a/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h_sec1
27
27
28
#include "SVGAngle.h"
28
#include "SVGAngle.h"
29
#include "SVGAnimatedDecoratedProperty.h"
29
#include "SVGAnimatedDecoratedProperty.h"
30
#include "SVGAnimatedLength.h"
31
#include "SVGAnimatedLengthList.h"
32
#include "SVGAnimatedPrimitiveProperty.h"
30
#include "SVGAnimatedPrimitiveProperty.h"
33
#include "SVGAnimatedPropertyList.h"
31
#include "SVGAnimatedPropertyList.h"
34
#include "SVGAnimatedTransformList.h"
32
#include "SVGAnimatedTransformList.h"
35
#include "SVGAnimatedValueProperty.h"
33
#include "SVGAnimatedValueProperty.h"
36
#include "SVGDecoratedEnumeration.h"
34
#include "SVGDecoratedEnumeration.h"
35
#include "SVGLength.h"
36
#include "SVGLengthList.h"
37
#include "SVGMarkerTypes.h"
37
#include "SVGMarkerTypes.h"
38
#include "SVGNumberList.h"
38
#include "SVGNumberList.h"
39
#include "SVGPointList.h"
39
#include "SVGPointList.h"
Lines 50-58 using SVGAnimatedString = SVGAnimatedPrimitiveProperty<String>; a/Source/WebCore/svg/properties/SVGAnimatedPropertyImpl.h_sec2
50
using SVGAnimatedEnumeration = SVGAnimatedDecoratedProperty<SVGDecoratedEnumeration, unsigned>;
50
using SVGAnimatedEnumeration = SVGAnimatedDecoratedProperty<SVGDecoratedEnumeration, unsigned>;
51
51
52
using SVGAnimatedAngle = SVGAnimatedValueProperty<SVGAngle>;
52
using SVGAnimatedAngle = SVGAnimatedValueProperty<SVGAngle>;
53
using SVGAnimatedLength = SVGAnimatedValueProperty<SVGLength>;
53
using SVGAnimatedRect = SVGAnimatedValueProperty<SVGRect>;
54
using SVGAnimatedRect = SVGAnimatedValueProperty<SVGRect>;
54
using SVGAnimatedPreserveAspectRatio = SVGAnimatedValueProperty<SVGPreserveAspectRatio>;
55
using SVGAnimatedPreserveAspectRatio = SVGAnimatedValueProperty<SVGPreserveAspectRatio>;
55
56
57
using SVGAnimatedLengthList = SVGAnimatedPropertyList<SVGLengthList>;
56
using SVGAnimatedNumberList = SVGAnimatedPropertyList<SVGNumberList>;
58
using SVGAnimatedNumberList = SVGAnimatedPropertyList<SVGNumberList>;
57
using SVGAnimatedPointList = SVGAnimatedPropertyList<SVGPointList>;
59
using SVGAnimatedPointList = SVGAnimatedPropertyList<SVGPointList>;
58
60
- a/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h +64 lines
Lines 26-37 a/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h_sec1
26
#pragma once
26
#pragma once
27
27
28
#include "SVGAnimationAdditiveListFunction.h"
28
#include "SVGAnimationAdditiveListFunction.h"
29
#include "SVGLengthList.h"
29
#include "SVGPointList.h"
30
#include "SVGPointList.h"
30
31
31
namespace WebCore {
32
namespace WebCore {
32
33
33
class SVGElement;
34
class SVGElement;
34
35
36
class SVGAnimationLengthListFunction : public SVGAnimationAdditiveListFunction<SVGLengthList> {
37
    using Base = SVGAnimationAdditiveListFunction<SVGLengthList>;
38
39
public:
40
    SVGAnimationLengthListFunction(AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
41
        : Base(animationMode, calcMode, isAccumulated, isAdditive, lengthMode)
42
    {
43
    }
44
45
    void setFromAndToValues(SVGElement*, const String& from, const String& to) override
46
    {
47
        m_from->parse(from);
48
        m_to->parse(to);
49
    }
50
51
    void setToAtEndOfDurationValue(const String& toAtEndOfDuration) override
52
    {
53
        m_toAtEndOfDuration->parse(toAtEndOfDuration);
54
    }
55
56
    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount, RefPtr<SVGLengthList>& animated)
57
    {
58
        if (!adjustAnimatedList(m_animationMode, percentage, animated))
59
            return;
60
61
        const Vector<Ref<SVGLength>>& fromItems = m_animationMode == AnimationMode::To ? animated->items() : m_from->items();
62
        const Vector<Ref<SVGLength>>& toItems = m_to->items();
63
        const Vector<Ref<SVGLength>>& toAtEndOfDurationItems = toAtEndOfDuration()->items();
64
        Vector<Ref<SVGLength>>& animatedItems = animated->items();
65
        SVGLengthMode lengthMode = animated->lengthMode();
66
67
        SVGLengthContext lengthContext(targetElement);
68
        for (unsigned i = 0; i < toItems.size(); ++i) {
69
            SVGLengthType unitType = (i < fromItems.size() && percentage < 0.5 ? fromItems : toItems)[i]->value().unitType();
70
71
            float from = i < fromItems.size() ? fromItems[i]->value().value(lengthContext) : 0;
72
            float to = toItems[i]->value().value(lengthContext);
73
            float toAtEndOfDuration = i < toAtEndOfDurationItems.size() ? toAtEndOfDurationItems[i]->value().value(lengthContext) : 0;
74
            float value = animatedItems[i]->value().value(lengthContext);
75
76
            value = Base::progress(percentage, repeatCount, from, to, toAtEndOfDuration, value);
77
            animatedItems[i]->value().setValue(lengthContext, value, lengthMode, unitType);
78
        }
79
    }
80
81
private:
82
    void addFromAndToValues(SVGElement* targetElement) override
83
    {
84
        const Vector<Ref<SVGLength>>& fromItems = m_from->items();
85
        const Vector<Ref<SVGLength>>& toItems = m_to->items();
86
87
        if (!fromItems.size() || fromItems.size() != toItems.size())
88
            return;
89
90
        SVGLengthContext lengthContext(targetElement);
91
        for (unsigned i = 0; i < fromItems.size(); ++i) {
92
            const SVGLengthValue& fromValue = fromItems[i]->value();
93
            SVGLengthValue& toValue = toItems[i]->value();
94
            toValue.setValue(toValue.value(lengthContext) + fromValue.value(lengthContext), lengthContext);
95
        }
96
    }
97
};
98
35
class SVGAnimationNumberListFunction : public SVGAnimationAdditiveListFunction<SVGNumberList> {
99
class SVGAnimationNumberListFunction : public SVGAnimationAdditiveListFunction<SVGNumberList> {
36
public:
100
public:
37
    using Base = SVGAnimationAdditiveListFunction<SVGNumberList>;
101
    using Base = SVGAnimationAdditiveListFunction<SVGNumberList>;
- a/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h +53 lines
Lines 148-153 private: a/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h_sec1
148
    }
148
    }
149
};
149
};
150
150
151
class SVGAnimationLengthFunction : public SVGAnimationAdditiveValueFunction<SVGLengthValue> {
152
    using Base = SVGAnimationAdditiveValueFunction<SVGLengthValue>;
153
154
public:
155
    SVGAnimationLengthFunction(AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
156
        : Base(animationMode, calcMode, isAccumulated, isAdditive)
157
        , m_lengthMode(lengthMode)
158
    {
159
    }
160
161
    void setFromAndToValues(SVGElement*, const String& from, const String& to) override
162
    {
163
        m_from = SVGLengthValue(m_lengthMode, from);
164
        m_to = SVGLengthValue(m_lengthMode, to);
165
    }
166
167
    void setToAtEndOfDurationValue(const String& toAtEndOfDuration) override
168
    {
169
        m_toAtEndOfDuration = SVGLengthValue(m_lengthMode, toAtEndOfDuration);
170
    }
171
172
    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount, SVGLengthValue& animated)
173
    {
174
        SVGLengthContext lengthContext(targetElement);
175
        SVGLengthType unitType = percentage < 0.5 ? m_from.unitType() : m_to.unitType();
176
177
        float from = (m_animationMode == AnimationMode::To ? animated : m_from).value(lengthContext);
178
        float to = m_to.value(lengthContext);
179
        float toAtEndOfDuration = this->toAtEndOfDuration().value(lengthContext);
180
        float value = animated.value(lengthContext);
181
182
        value = Base::progress(percentage, repeatCount, from, to, toAtEndOfDuration, value);
183
        animated = { lengthContext, value, m_lengthMode, unitType };
184
    }
185
186
    float calculateDistance(SVGElement* targetElement, const String& from, const String& to) const override
187
    {
188
        SVGLengthContext lengthContext(targetElement);
189
        auto fromLength = SVGLengthValue(m_lengthMode, from);
190
        auto toLength = SVGLengthValue(m_lengthMode, to);
191
        return fabsf(toLength.value(lengthContext) - fromLength.value(lengthContext));
192
    }
193
194
private:
195
    void addFromAndToValues(SVGElement* targetElement) override
196
    {
197
        SVGLengthContext lengthContext(targetElement);
198
        m_to.setValue(m_to.value(lengthContext) + m_from.value(lengthContext), lengthContext);
199
    }
200
201
    SVGLengthMode m_lengthMode;
202
};
203
151
class SVGAnimationNumberFunction : public SVGAnimationAdditiveValueFunction<float> {
204
class SVGAnimationNumberFunction : public SVGAnimationAdditiveValueFunction<float> {
152
    friend class SVGAnimatedNumberPairAnimator;
205
    friend class SVGAnimatedNumberPairAnimator;
153
206
- a/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp +5 lines
Lines 32-37 a/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp_sec1
32
32
33
namespace WebCore {
33
namespace WebCore {
34
34
35
bool SVGAttributeAnimator::isAnimatedStylePropertyAniamtor(const SVGElement* targetElement) const
36
{
37
    return targetElement->isAnimatedStyleAttribute(m_attributeName);
38
}
39
35
void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement* element, CSSPropertyID id, const String& value)
40
void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement* element, CSSPropertyID id, const String& value)
36
{
41
{
37
    ASSERT(element);
42
    ASSERT(element);
- a/Source/WebCore/svg/properties/SVGAttributeAnimator.h +2 lines
Lines 74-79 public: a/Source/WebCore/svg/properties/SVGAttributeAnimator.h_sec1
74
    virtual float calculateDistance(SVGElement*, const String&, const String&) const { return -1; }
74
    virtual float calculateDistance(SVGElement*, const String&, const String&) const { return -1; }
75
75
76
protected:
76
protected:
77
    bool isAnimatedStylePropertyAniamtor(const SVGElement*) const;
78
77
    static void applyAnimatedStylePropertyChange(SVGElement*, CSSPropertyID, const String& value);
79
    static void applyAnimatedStylePropertyChange(SVGElement*, CSSPropertyID, const String& value);
78
    static void removeAnimatedStyleProperty(SVGElement*, CSSPropertyID);
80
    static void removeAnimatedStyleProperty(SVGElement*, CSSPropertyID);
79
    static void applyAnimatedPropertyChange(SVGElement*, const QualifiedName&);
81
    static void applyAnimatedPropertyChange(SVGElement*, const QualifiedName&);
- a/Source/WebCore/svg/properties/SVGAttributeRegistry.h -14 lines
Lines 25-32 a/Source/WebCore/svg/properties/SVGAttributeRegistry.h_sec1
25
25
26
#pragma once
26
#pragma once
27
27
28
#include "SVGAnimatedLength.h"
29
#include "SVGAnimatedLengthList.h"
30
#include "SVGAnimatedTransformList.h"
28
#include "SVGAnimatedTransformList.h"
31
#include "SVGAttributeAccessor.h"
29
#include "SVGAttributeAccessor.h"
32
#include "SVGLegacyAnimatedProperty.h"
30
#include "SVGLegacyAnimatedProperty.h"
Lines 51-68 public: a/Source/WebCore/svg/properties/SVGAttributeRegistry.h_sec2
51
    }
49
    }
52
50
53
    // Animatable attributes
51
    // Animatable attributes
54
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedLengthAttribute OwnerType::*attribute>
55
    void registerAttribute()
56
    {
57
        registerAttribute(SVGAnimatedLengthAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
58
    }
59
60
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedLengthListAttribute OwnerType::*attribute>
61
    void registerAttribute()
62
    {
63
        registerAttribute(SVGAnimatedLengthListAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());
64
    }
65
66
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedTransformListAttribute OwnerType::*attribute>
52
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGAnimatedTransformListAttribute OwnerType::*attribute>
67
    void registerAttribute()
53
    void registerAttribute()
68
    {
54
    {
- a/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h -6 / +28 lines
Lines 25-32 a/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h_sec1
25
25
26
#pragma once
26
#pragma once
27
27
28
#include "SVGLength.h"
28
#include "SVGNames.h"
29
#include "SVGNames.h"
29
#include "SVGPrimitivePropertyAnimatorImpl.h"
30
#include "SVGPrimitivePropertyAnimatorImpl.h"
31
#include "SVGValuePropertyAnimatorImpl.h"
32
#include "SVGValuePropertyListAnimatorImpl.h"
30
33
31
namespace WebCore {
34
namespace WebCore {
32
35
Lines 80-85 private: a/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h_sec2
80
        return SVGColorAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
83
        return SVGColorAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
81
    }
84
    }
82
85
86
    static auto createLengthAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
87
    {
88
        return SVGLengthAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
89
    }
90
91
    static auto createLengthListAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
92
    {
93
        return SVGLengthListAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
94
    }
95
83
    static auto createNumberAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
96
    static auto createNumberAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
84
    {
97
    {
85
        return SVGNumberAnimator::create(attributeName,  WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
98
        return SVGNumberAnimator::create(attributeName,  WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
Lines 93-105 private: a/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h_sec3
93
    static const AttributeAnimatorCreator& attributeAnimatorCreator()
106
    static const AttributeAnimatorCreator& attributeAnimatorCreator()
94
    {
107
    {
95
        static NeverDestroyed<AttributeAnimatorCreator> map = AttributeAnimatorCreator({
108
        static NeverDestroyed<AttributeAnimatorCreator> map = AttributeAnimatorCreator({
96
            { SVGNames::colorAttr->impl(),          std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
109
            { SVGNames::colorAttr->impl(),              std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
97
            { SVGNames::fillAttr->impl(),           std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
110
            { SVGNames::fillAttr->impl(),               std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
98
            { SVGNames::flood_colorAttr->impl(),    std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
111
            { SVGNames::flood_colorAttr->impl(),        std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
99
            { SVGNames::lighting_colorAttr->impl(), std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
112
            { SVGNames::lighting_colorAttr->impl(),     std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
100
            { SVGNames::stop_colorAttr->impl(),     std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
113
            { SVGNames::stop_colorAttr->impl(),         std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
101
            { SVGNames::strokeAttr->impl(),         std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
114
            { SVGNames::strokeAttr->impl(),             std::make_pair(SVGValueProperty<Color>::create, SVGPropertyAnimatorFactory::createColorAnimator) },
102
115
116
            { SVGNames::font_sizeAttr->impl(),          std::make_pair([]() { return SVGLength::create(); }, SVGPropertyAnimatorFactory::createLengthAnimator) },
117
            { SVGNames::kerningAttr->impl(),            std::make_pair([]() { return SVGLength::create(); }, SVGPropertyAnimatorFactory::createLengthAnimator) },
118
            { SVGNames::letter_spacingAttr->impl(),     std::make_pair([]() { return SVGLength::create(); }, SVGPropertyAnimatorFactory::createLengthAnimator) },
119
            { SVGNames::stroke_dashoffsetAttr->impl(),  std::make_pair([]() { return SVGLength::create(); }, SVGPropertyAnimatorFactory::createLengthAnimator) },
120
            { SVGNames::stroke_widthAttr->impl(),       std::make_pair([]() { return SVGLength::create(); }, SVGPropertyAnimatorFactory::createLengthAnimator) },
121
            { SVGNames::word_spacingAttr->impl(),       std::make_pair([]() { return SVGLength::create(); }, SVGPropertyAnimatorFactory::createLengthAnimator) },
122
123
            { SVGNames::stroke_dasharrayAttr->impl(),   std::make_pair([]() { return SVGLengthList::create(); }, SVGPropertyAnimatorFactory::createLengthListAnimator) },
124
            
103
            { SVGNames::fill_opacityAttr->impl(),       std::make_pair(SVGValueProperty<float>::create, SVGPropertyAnimatorFactory::createNumberAnimator) },
125
            { SVGNames::fill_opacityAttr->impl(),       std::make_pair(SVGValueProperty<float>::create, SVGPropertyAnimatorFactory::createNumberAnimator) },
104
            { SVGNames::flood_opacityAttr->impl(),      std::make_pair(SVGValueProperty<float>::create, SVGPropertyAnimatorFactory::createNumberAnimator) },
126
            { SVGNames::flood_opacityAttr->impl(),      std::make_pair(SVGValueProperty<float>::create, SVGPropertyAnimatorFactory::createNumberAnimator) },
105
            { SVGNames::opacityAttr->impl(),            std::make_pair(SVGValueProperty<float>::create, SVGPropertyAnimatorFactory::createNumberAnimator) },
127
            { SVGNames::opacityAttr->impl(),            std::make_pair(SVGValueProperty<float>::create, SVGPropertyAnimatorFactory::createNumberAnimator) },
- a/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h +12 lines
Lines 66-71 public: a/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h_sec1
66
    {
66
    {
67
        registerProperty(attributeName, SVGAnimatedIntegerAccessor<OwnerType>::template singleton<property>());
67
        registerProperty(attributeName, SVGAnimatedIntegerAccessor<OwnerType>::template singleton<property>());
68
    }
68
    }
69
    
70
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedLength> OwnerType::*property>
71
    static void registerProperty()
72
    {
73
        registerProperty(attributeName, SVGAnimatedLengthAccessor<OwnerType>::template singleton<property>());
74
    }
75
76
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedLengthList> OwnerType::*property>
77
    static void registerProperty()
78
    {
79
        registerProperty(attributeName, SVGAnimatedLengthListAccessor<OwnerType>::template singleton<property>());
80
    }
69
81
70
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedNumber> OwnerType::*property>
82
    template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedNumber> OwnerType::*property>
71
    static void registerProperty()
83
    static void registerProperty()
- a/Source/WebCore/svg/properties/SVGValuePropertyAnimator.h +64 lines
Line 0 a/Source/WebCore/svg/properties/SVGValuePropertyAnimator.h_sec1
1
/*
2
 * Copyright (C) 2018-2019 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 "SVGPropertyAnimator.h"
29
30
namespace WebCore {
31
32
template<typename PropertyType, typename AnimationFunction>
33
class SVGValuePropertyAnimator : public SVGPropertyAnimator<AnimationFunction> {
34
    using Base = SVGPropertyAnimator<AnimationFunction>;
35
    using Base::Base;
36
    using Base::applyAnimatedStylePropertyChange;
37
    using Base::m_function;
38
39
public:
40
    template<typename... Arguments>
41
    SVGValuePropertyAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, Arguments&&... arguments)
42
        : Base(attributeName, std::forward<Arguments>(arguments)...)
43
        , m_property(static_reference_cast<PropertyType>(WTFMove(property)))
44
    {
45
    }
46
47
    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) override
48
    {
49
        m_function.progress(targetElement, percentage, repeatCount, m_property->value());
50
    }
51
52
    void apply(SVGElement* targetElement) override
53
    {
54
        applyAnimatedStylePropertyChange(targetElement, m_property->valueAsString());
55
    }
56
57
protected:
58
    using Base::computeCSSPropertyValue;
59
    using Base::m_attributeName;
60
61
    Ref<PropertyType> m_property;
62
};
63
64
}
- a/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h +55 lines
Line 0 a/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h_sec1
1
/*
2
 * Copyright (C) 2018-2019 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 "SVGAnimationFunction.h"
29
#include "SVGValuePropertyAnimator.h"
30
31
namespace WebCore {
32
33
class SVGLengthAnimator final : public SVGValuePropertyAnimator<SVGLength, SVGAnimationLengthFunction> {
34
    using Base = SVGValuePropertyAnimator<SVGLength, SVGAnimationLengthFunction>;
35
    using Base::Base;
36
    using Base::m_attributeName;
37
    using Base::m_property;
38
39
public:
40
    static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
41
    {
42
        return std::make_unique<SVGLengthAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, LengthModeOther);
43
    }
44
45
    void start(SVGElement* targetElement) override
46
    {
47
        String baseValue = computeCSSPropertyValue(targetElement, cssPropertyID(m_attributeName.localName()));
48
        SVGLengthValue value(LengthModeOther);
49
        if (!value.setValueAsString(baseValue).hasException())
50
            m_property->setValue(value);
51
    }
52
};
53
54
}
55
- a/Source/WebCore/svg/properties/SVGValuePropertyListAnimator.h +64 lines
Line 0 a/Source/WebCore/svg/properties/SVGValuePropertyListAnimator.h_sec1
1
/*
2
 * Copyright (C) 2018-2019 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 "SVGPropertyAnimator.h"
29
30
namespace WebCore {
31
32
template<typename ListType, typename AnimationFunction>
33
class SVGValuePropertyListAnimator : public SVGPropertyAnimator<AnimationFunction> {
34
    using Base = SVGPropertyAnimator<AnimationFunction>;
35
    using Base::Base;
36
    using Base::applyAnimatedStylePropertyChange;
37
    using Base::m_function;
38
39
public:
40
    template<typename... Arguments>
41
    SVGValuePropertyListAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, Arguments&&... arguments)
42
        : Base(attributeName, std::forward<Arguments>(arguments)...)
43
        , m_list(static_reference_cast<ListType>(WTFMove(property)))
44
    {
45
    }
46
47
    void progress(SVGElement* targetElement, float percentage, unsigned repeatCount) override
48
    {
49
        m_function.progress(targetElement, percentage, repeatCount, m_list);
50
    }
51
52
    void apply(SVGElement* targetElement) override
53
    {
54
        applyAnimatedStylePropertyChange(targetElement, m_list->valueAsString());
55
    }
56
57
protected:
58
    using Base::computeCSSPropertyValue;
59
    using Base::m_attributeName;
60
61
    RefPtr<ListType> m_list;
62
};
63
64
}
- a/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h +53 lines
Line 0 a/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h_sec1
1
/*
2
 * Copyright (C) 2018-2019 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 "SVGAnimationFunction.h"
29
#include "SVGValuePropertyListAnimator.h"
30
31
namespace WebCore {
32
33
class SVGLengthListAnimator final : public SVGValuePropertyListAnimator<SVGLengthList, SVGAnimationLengthListFunction> {
34
    using Base = SVGValuePropertyListAnimator<SVGLengthList, SVGAnimationLengthListFunction>;
35
    using Base::Base;
36
    using Base::m_attributeName;
37
    using Base::m_list;
38
39
public:
40
    static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
41
    {
42
        return std::make_unique<SVGLengthListAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, LengthModeOther);
43
    }
44
45
    void start(SVGElement* targetElement) override
46
    {
47
        String baseValue = computeCSSPropertyValue(targetElement, cssPropertyID(m_attributeName.localName()));
48
        if (!m_list->parse(baseValue))
49
            m_list->clearItems();
50
    }
51
};
52
53
}
- a/LayoutTests/ChangeLog +26 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2019-03-26  Said Abou-Hallawa  <said@apple.com>
2
3
        Remove the SVG tear off objects for SVGLength, SVGLengthList and SVGAnimatedLengthList
4
        https://bugs.webkit.org/show_bug.cgi?id=196083
5
6
        Reviewed by Simon Fraser.
7
8
        * platform/win/TestExpectations:
9
        * svg/animations/svglength-element-removed-crash.svg:
10
        * svg/dom/SVGLengthList-appendItem-expected.txt:
11
        * svg/dom/SVGLengthList-appendItem.xhtml:
12
        * svg/dom/SVGLengthList-basics-expected.txt:
13
        * svg/dom/SVGLengthList-basics.xhtml:
14
        * svg/dom/SVGLengthList-initialize-expected.txt:
15
        * svg/dom/SVGLengthList-initialize.xhtml:
16
        * svg/dom/SVGLengthList-insertItemBefore-expected.txt:
17
        * svg/dom/SVGLengthList-insertItemBefore.xhtml:
18
        * svg/dom/SVGLengthList-removeItem-expected.txt:
19
        * svg/dom/SVGLengthList-removeItem.xhtml:
20
        * svg/dom/SVGLengthList-replaceItem-expected.txt:
21
        * svg/dom/SVGLengthList-replaceItem.xhtml:
22
        This changes are required because SVGLengthList will be following the SVG2
23
        specs regarding adding new items to the list. 
24
25
        See https://www.w3.org/TR/SVG/types.html#TermListInterface.
26
1
2019-03-26  Per Arne Vollan  <pvollan@apple.com>
27
2019-03-26  Per Arne Vollan  <pvollan@apple.com>
2
28
3
        Layout Test js/math-clz32.html is failing
29
        Layout Test js/math-clz32.html is failing
- a/LayoutTests/platform/win/TestExpectations +3 lines
Lines 1954-1959 imported/mozilla/svg/svg-effects-area-zoomed-in.xhtml a/LayoutTests/platform/win/TestExpectations_sec1
1954
imported/mozilla/svg/svg-effects-area-zoomed-out.xhtml
1954
imported/mozilla/svg/svg-effects-area-zoomed-out.xhtml
1955
svg/filters/feImage-self-and-other-referencing.html
1955
svg/filters/feImage-self-and-other-referencing.html
1956
1956
1957
# GCController.collect() issues.
1958
svg/animations/svglength-element-removed-crash.svg [ Failure ]
1959
1957
################################################################################
1960
################################################################################
1958
###################          End SVG Issues              #######################
1961
###################          End SVG Issues              #######################
1959
################################################################################
1962
################################################################################
- a/LayoutTests/svg/animations/svglength-element-removed-crash.svg -2 / +2 lines
Lines 32-39 function load() { a/LayoutTests/svg/animations/svglength-element-removed-crash.svg_sec1
32
    // The rest of this test should FAIL without requiring gmalloc if this test has regressed.
32
    // The rest of this test should FAIL without requiring gmalloc if this test has regressed.
33
    var liveDelta = window.internals.numberOfLiveNodes() - originalLiveElements;
33
    var liveDelta = window.internals.numberOfLiveNodes() - originalLiveElements;
34
    
34
    
35
    // Make sure that the <rect> is still alive; if it's not, liveDelta will be -1.
35
    // Make sure that the <rect> is deleted; if it's not, liveDelta will be 0.
36
    if (liveDelta == 0)
36
    if (liveDelta == -1)
37
        log(" PASS");
37
        log(" PASS");
38
    else
38
    else
39
        log(" FAIL: " + liveDelta + " extra live node(s)");
39
        log(" FAIL: " + liveDelta + " extra live node(s)");
- a/LayoutTests/svg/dom/SVGLengthList-appendItem-expected.txt -2 / +10 lines
Lines 27-33 PASS text2.x.baseVal.getItem(2).value is 1000 a/LayoutTests/svg/dom/SVGLengthList-appendItem-expected.txt_sec1
27
PASS text2.x.baseVal.getItem(3) threw exception IndexSizeError: The index is not in the allowed range..
27
PASS text2.x.baseVal.getItem(3) threw exception IndexSizeError: The index is not in the allowed range..
28
28
29
Append fourth item x=900 to the text1 x list
29
Append fourth item x=900 to the text1 x list
30
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3)) is text1.x.baseVal.getItem(4)
30
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3)) is text1.x.baseVal.getItem(5)
31
PASS text1.x.baseVal.removeItem(3).toString() is "[object SVGLength]"
31
PASS text1.x.baseVal.numberOfItems is 5
32
PASS text1.x.baseVal.numberOfItems is 5
32
PASS text1.x.baseVal.getItem(0).value is 500
33
PASS text1.x.baseVal.getItem(0).value is 500
33
PASS text1.x.baseVal.getItem(1).value is 50
34
PASS text1.x.baseVal.getItem(1).value is 50
Lines 37-43 PASS text1.x.baseVal.getItem(4).value is 900 a/LayoutTests/svg/dom/SVGLengthList-appendItem-expected.txt_sec2
37
PASS text1.x.baseVal.getItem(5) threw exception IndexSizeError: The index is not in the allowed range..
38
PASS text1.x.baseVal.getItem(5) threw exception IndexSizeError: The index is not in the allowed range..
38
39
39
Append first item x=500 to the text1 x list
40
Append first item x=500 to the text1 x list
40
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0)) is text1.x.baseVal.getItem(4)
41
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0)) is text1.x.baseVal.getItem(5)
42
PASS text1.x.baseVal.removeItem(0).toString() is "[object SVGLength]"
41
PASS text1.x.baseVal.numberOfItems is 5
43
PASS text1.x.baseVal.numberOfItems is 5
42
PASS text1.x.baseVal.getItem(0).value is 50
44
PASS text1.x.baseVal.getItem(0).value is 50
43
PASS text1.x.baseVal.getItem(1).value is 100
45
PASS text1.x.baseVal.getItem(1).value is 100
Lines 59-65 PASS text1.x.baseVal.getItem(6) threw exception IndexSizeError: The index is not a/LayoutTests/svg/dom/SVGLengthList-appendItem-expected.txt_sec3
59
61
60
Append third and fourth item of the text1 x list to the text2 x list
62
Append third and fourth item of the text1 x list to the text2 x list
61
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 1000
63
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 1000
64
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
62
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 900
65
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 900
66
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
63
PASS text1.x.baseVal.numberOfItems is 4
67
PASS text1.x.baseVal.numberOfItems is 4
64
PASS text1.x.baseVal.getItem(0).value is 50
68
PASS text1.x.baseVal.getItem(0).value is 50
65
PASS text1.x.baseVal.getItem(1).value is 100
69
PASS text1.x.baseVal.getItem(1).value is 100
Lines 77-86 PASS newLength2.value is 150 a/LayoutTests/svg/dom/SVGLengthList-appendItem-expected.txt_sec4
77
81
78
Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists
82
Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists
79
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 500
83
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 500
84
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
80
PASS text2.x.baseVal.appendItem(newLength2).value is 150
85
PASS text2.x.baseVal.appendItem(newLength2).value is 150
81
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
86
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
87
PASS text2.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
82
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value is 900
88
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value is 900
89
PASS text2.x.baseVal.removeItem(3).toString() is "[object SVGLength]"
83
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
90
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
91
PASS text2.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
84
PASS text1.x.baseVal.numberOfItems is 4
92
PASS text1.x.baseVal.numberOfItems is 4
85
PASS text1.x.baseVal.getItem(0).value is 50
93
PASS text1.x.baseVal.getItem(0).value is 50
86
PASS text1.x.baseVal.getItem(1).value is 100
94
PASS text1.x.baseVal.getItem(1).value is 100
- a/LayoutTests/svg/dom/SVGLengthList-appendItem.xhtml -2 / +10 lines
Lines 46-52 a/LayoutTests/svg/dom/SVGLengthList-appendItem.xhtml_sec1
46
46
47
    debug("");
47
    debug("");
48
    debug("Append fourth item x=900 to the text1 x list");
48
    debug("Append fourth item x=900 to the text1 x list");
49
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3))", "text1.x.baseVal.getItem(4)");
49
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3))", "text1.x.baseVal.getItem(5)");
50
    shouldBeEqualToString("text1.x.baseVal.removeItem(3).toString()", "[object SVGLength]");
50
    shouldBe("text1.x.baseVal.numberOfItems", "5");
51
    shouldBe("text1.x.baseVal.numberOfItems", "5");
51
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
52
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
52
    shouldBe("text1.x.baseVal.getItem(1).value", "50");
53
    shouldBe("text1.x.baseVal.getItem(1).value", "50");
Lines 57-63 a/LayoutTests/svg/dom/SVGLengthList-appendItem.xhtml_sec2
57
58
58
    debug("");
59
    debug("");
59
    debug("Append first item x=500 to the text1 x list");
60
    debug("Append first item x=500 to the text1 x list");
60
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0))", "text1.x.baseVal.getItem(4)");
61
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0))", "text1.x.baseVal.getItem(5)");
62
    shouldBeEqualToString("text1.x.baseVal.removeItem(0).toString()", "[object SVGLength]");
61
    shouldBe("text1.x.baseVal.numberOfItems", "5");
63
    shouldBe("text1.x.baseVal.numberOfItems", "5");
62
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
64
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
63
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
65
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
Lines 81-87 a/LayoutTests/svg/dom/SVGLengthList-appendItem.xhtml_sec3
81
    debug("");
83
    debug("");
82
    debug("Append third and fourth item of the text1 x list to the text2 x list");
84
    debug("Append third and fourth item of the text1 x list to the text2 x list");
83
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "1000");
85
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "1000");
86
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
84
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "900");
87
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "900");
88
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
85
    shouldBe("text1.x.baseVal.numberOfItems", "4");
89
    shouldBe("text1.x.baseVal.numberOfItems", "4");
86
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
90
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
87
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
91
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
Lines 103-112 a/LayoutTests/svg/dom/SVGLengthList-appendItem.xhtml_sec4
103
    debug("");
107
    debug("");
104
    debug("Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists");
108
    debug("Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists");
105
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "500");
109
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "500");
110
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
106
    shouldBe("text2.x.baseVal.appendItem(newLength2).value", "150");
111
    shouldBe("text2.x.baseVal.appendItem(newLength2).value", "150");
107
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
112
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
113
    shouldBeEqualToString("text2.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
108
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value", "900");
114
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value", "900");
115
    shouldBeEqualToString("text2.x.baseVal.removeItem(3).toString()", "[object SVGLength]");
109
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
116
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
117
    shouldBeEqualToString("text2.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
110
    shouldBe("text1.x.baseVal.numberOfItems", "4");
118
    shouldBe("text1.x.baseVal.numberOfItems", "4");
111
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
119
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
112
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
120
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
- a/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt -5 / +16 lines
Lines 29-52 PASS text1.x.baseVal.insertItemBefore('aString') threw exception TypeError: Not a/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt_sec1
29
PASS text1.x.baseVal.insertItemBefore(text1) threw exception TypeError: Not enough arguments.
29
PASS text1.x.baseVal.insertItemBefore(text1) threw exception TypeError: Not enough arguments.
30
PASS text1.x.baseVal.insertItemBefore(null) threw exception TypeError: Not enough arguments.
30
PASS text1.x.baseVal.insertItemBefore(null) threw exception TypeError: Not enough arguments.
31
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 'aString') is text1.x.baseVal.getItem(0)
31
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 'aString') is text1.x.baseVal.getItem(0)
32
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
32
PASS text1.x.baseVal.numberOfItems is 3
33
PASS text1.x.baseVal.numberOfItems is 3
33
PASS text1.x.baseVal.getItem(0).value is 1000
34
PASS text1.x.baseVal.getItem(0).value is 1000
34
PASS text1.x.baseVal.getItem(1).value is 500
35
PASS text1.x.baseVal.getItem(1).value is 500
35
PASS text1.x.baseVal.getItem(2).value is 1500
36
PASS text1.x.baseVal.getItem(2).value is 1500
36
PASS text1.getAttribute('x') is "1000 500 1500"
37
PASS text1.getAttribute('x') is "1000 500 1500"
37
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), text1) is text1.x.baseVal.getItem(0)
38
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), text1) is text1.x.baseVal.getItem(0)
39
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
38
PASS text1.x.baseVal.numberOfItems is 3
40
PASS text1.x.baseVal.numberOfItems is 3
39
PASS text1.x.baseVal.getItem(0).value is 500
41
PASS text1.x.baseVal.getItem(0).value is 500
40
PASS text1.x.baseVal.getItem(1).value is 1000
42
PASS text1.x.baseVal.getItem(1).value is 1000
41
PASS text1.x.baseVal.getItem(2).value is 1500
43
PASS text1.x.baseVal.getItem(2).value is 1500
42
PASS text1.getAttribute('x') is "500 1000 1500"
44
PASS text1.getAttribute('x') is "500 1000 1500"
43
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), null) is text1.x.baseVal.getItem(0)
45
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), null) is text1.x.baseVal.getItem(0)
46
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
44
PASS text1.x.baseVal.numberOfItems is 3
47
PASS text1.x.baseVal.numberOfItems is 3
45
PASS text1.x.baseVal.getItem(0).value is 1000
48
PASS text1.x.baseVal.getItem(0).value is 1000
46
PASS text1.x.baseVal.getItem(1).value is 500
49
PASS text1.x.baseVal.getItem(1).value is 500
47
PASS text1.x.baseVal.getItem(2).value is 1500
50
PASS text1.x.baseVal.getItem(2).value is 1500
48
PASS text1.getAttribute('x') is "1000 500 1500"
51
PASS text1.getAttribute('x') is "1000 500 1500"
49
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0) is text1.x.baseVal.getItem(0)
52
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0) is text1.x.baseVal.getItem(0)
53
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
50
PASS text1.x.baseVal.numberOfItems is 3
54
PASS text1.x.baseVal.numberOfItems is 3
51
PASS text1.x.baseVal.getItem(0).value is 500
55
PASS text1.x.baseVal.getItem(0).value is 500
52
PASS text1.x.baseVal.getItem(1).value is 1000
56
PASS text1.x.baseVal.getItem(1).value is 1000
Lines 62-71 PASS text1.setAttribute('x', '1 2 3 4') is undefined. a/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt_sec2
62
66
63
Test edge cases for insertItemBefore()
67
Test edge cases for insertItemBefore()
64
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(3), 3) is text1.x.baseVal.getItem(3)
68
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(3), 3) is text1.x.baseVal.getItem(3)
69
PASS text1.x.baseVal.removeItem(4).toString() is "[object SVGLength]"
65
PASS text1.getAttribute('x') is "1 2 3 4"
70
PASS text1.getAttribute('x') is "1 2 3 4"
66
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 5) is text1.x.baseVal.getItem(3)
71
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 5) is text1.x.baseVal.getItem(4)
72
PASS text1.x.baseVal.removeItem(1).toString() is "[object SVGLength]"
67
PASS text1.getAttribute('x') is "1 3 4 2"
73
PASS text1.getAttribute('x') is "1 3 4 2"
68
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0) is text1.x.baseVal.getItem(0)
74
PASS text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0) is text1.x.baseVal.getItem(0)
75
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
69
PASS text1.getAttribute('x') is "3 1 4 2"
76
PASS text1.getAttribute('x') is "3 1 4 2"
70
77
71
Set x='1 2 3 4' for text1
78
Set x='1 2 3 4' for text1
Lines 111-117 Test edge cases for replaceItem() a/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt_sec3
111
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 3) is text1.x.baseVal.getItem(3)
118
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 3) is text1.x.baseVal.getItem(3)
112
PASS text1.x.baseVal.numberOfItems is 4
119
PASS text1.x.baseVal.numberOfItems is 4
113
PASS text1.getAttribute('x') is "1 2 3 4"
120
PASS text1.getAttribute('x') is "1 2 3 4"
114
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(1), 3) is text1.x.baseVal.getItem(2)
121
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(1), 3) is text1.x.baseVal.getItem(3)
122
PASS text1.x.baseVal.removeItem(1).toString() is "[object SVGLength]"
115
PASS text1.x.baseVal.numberOfItems is 3
123
PASS text1.x.baseVal.numberOfItems is 3
116
PASS text1.getAttribute('x') is "1 3 2"
124
PASS text1.getAttribute('x') is "1 3 2"
117
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 4) threw exception IndexSizeError: The index is not in the allowed range..
125
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 4) threw exception IndexSizeError: The index is not in the allowed range..
Lines 120-132 Set x='1 2 3 4' for text1 a/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt_sec4
120
PASS text1.setAttribute('x', '1 2 3 4') is undefined.
128
PASS text1.setAttribute('x', '1 2 3 4') is undefined.
121
129
122
Test overlapping edge cases for replaceItem()
130
Test overlapping edge cases for replaceItem()
123
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 3) is text1.x.baseVal.getItem(2)
131
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 3) is text1.x.baseVal.getItem(3)
132
PASS text1.x.baseVal.removeItem(0).toString() is "[object SVGLength]"
124
PASS text1.x.baseVal.numberOfItems is 3
133
PASS text1.x.baseVal.numberOfItems is 3
125
PASS text1.x.baseVal.getItem(2).value is 2
134
PASS text1.x.baseVal.getItem(2).value is 2
126
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 2) is text1.x.baseVal.getItem(1)
135
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 2) is text1.x.baseVal.getItem(2)
136
PASS text1.x.baseVal.removeItem(0).toString() is "[object SVGLength]"
127
PASS text1.x.baseVal.numberOfItems is 2
137
PASS text1.x.baseVal.numberOfItems is 2
128
PASS text1.x.baseVal.getItem(1).value is 4
138
PASS text1.x.baseVal.getItem(1).value is 4
129
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 1) is text1.x.baseVal.getItem(0)
139
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 1) is text1.x.baseVal.getItem(1)
140
PASS text1.x.baseVal.removeItem(1).toString() is "[object SVGLength]"
130
PASS text1.x.baseVal.numberOfItems is 1
141
PASS text1.x.baseVal.numberOfItems is 1
131
PASS text1.x.baseVal.getItem(0).value is 6
142
PASS text1.x.baseVal.getItem(0).value is 6
132
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0) is text1.x.baseVal.getItem(0)
143
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0) is text1.x.baseVal.getItem(0)
- a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml -5 / +16 lines
Lines 50-55 a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml_sec1
50
    shouldThrow("text1.x.baseVal.insertItemBefore(null)");
50
    shouldThrow("text1.x.baseVal.insertItemBefore(null)");
51
51
52
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 'aString')", "text1.x.baseVal.getItem(0)");
52
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 'aString')", "text1.x.baseVal.getItem(0)");
53
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
53
    shouldBe("text1.x.baseVal.numberOfItems", "3");
54
    shouldBe("text1.x.baseVal.numberOfItems", "3");
54
    shouldBe("text1.x.baseVal.getItem(0).value", "1000");
55
    shouldBe("text1.x.baseVal.getItem(0).value", "1000");
55
    shouldBe("text1.x.baseVal.getItem(1).value", "500");
56
    shouldBe("text1.x.baseVal.getItem(1).value", "500");
Lines 57-62 a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml_sec2
57
    shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1500");
58
    shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1500");
58
59
59
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), text1)", "text1.x.baseVal.getItem(0)");
60
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), text1)", "text1.x.baseVal.getItem(0)");
61
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
60
    shouldBe("text1.x.baseVal.numberOfItems", "3");
62
    shouldBe("text1.x.baseVal.numberOfItems", "3");
61
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
63
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
62
    shouldBe("text1.x.baseVal.getItem(1).value", "1000");
64
    shouldBe("text1.x.baseVal.getItem(1).value", "1000");
Lines 64-69 a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml_sec3
64
    shouldBeEqualToString("text1.getAttribute('x')", "500 1000 1500");
66
    shouldBeEqualToString("text1.getAttribute('x')", "500 1000 1500");
65
67
66
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), null)", "text1.x.baseVal.getItem(0)");
68
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), null)", "text1.x.baseVal.getItem(0)");
69
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
67
    shouldBe("text1.x.baseVal.numberOfItems", "3");
70
    shouldBe("text1.x.baseVal.numberOfItems", "3");
68
    shouldBe("text1.x.baseVal.getItem(0).value", "1000");
71
    shouldBe("text1.x.baseVal.getItem(0).value", "1000");
69
    shouldBe("text1.x.baseVal.getItem(1).value", "500");
72
    shouldBe("text1.x.baseVal.getItem(1).value", "500");
Lines 71-76 a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml_sec4
71
    shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1500");
74
    shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1500");
72
75
73
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)", "text1.x.baseVal.getItem(0)");
76
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)", "text1.x.baseVal.getItem(0)");
77
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
74
    shouldBe("text1.x.baseVal.numberOfItems", "3");
78
    shouldBe("text1.x.baseVal.numberOfItems", "3");
75
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
79
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
76
    shouldBe("text1.x.baseVal.getItem(1).value", "1000");
80
    shouldBe("text1.x.baseVal.getItem(1).value", "1000");
Lines 89-98 a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml_sec5
89
    debug("");
93
    debug("");
90
    debug("Test edge cases for insertItemBefore()");
94
    debug("Test edge cases for insertItemBefore()");
91
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(3), 3)", "text1.x.baseVal.getItem(3)");
95
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(3), 3)", "text1.x.baseVal.getItem(3)");
96
    shouldBeEqualToString("text1.x.baseVal.removeItem(4).toString()", "[object SVGLength]");
92
    shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
97
    shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
93
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 5)", "text1.x.baseVal.getItem(3)");
98
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 5)", "text1.x.baseVal.getItem(4)");
99
    shouldBeEqualToString("text1.x.baseVal.removeItem(1).toString()", "[object SVGLength]");
94
    shouldBeEqualToString("text1.getAttribute('x')", "1 3 4 2");
100
    shouldBeEqualToString("text1.getAttribute('x')", "1 3 4 2");
95
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)", "text1.x.baseVal.getItem(0)");
101
    shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)", "text1.x.baseVal.getItem(0)");
102
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
96
    shouldBeEqualToString("text1.getAttribute('x')", "3 1 4 2");
103
    shouldBeEqualToString("text1.getAttribute('x')", "3 1 4 2");
97
104
98
    debug("");
105
    debug("");
Lines 145-151 a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml_sec6
145
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 3)", "text1.x.baseVal.getItem(3)");
152
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 3)", "text1.x.baseVal.getItem(3)");
146
    shouldBe("text1.x.baseVal.numberOfItems", "4");
153
    shouldBe("text1.x.baseVal.numberOfItems", "4");
147
    shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
154
    shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
148
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(1), 3)", "text1.x.baseVal.getItem(2)");
155
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(1), 3)", "text1.x.baseVal.getItem(3)");
156
    shouldBeEqualToString("text1.x.baseVal.removeItem(1).toString()", "[object SVGLength]");
149
    shouldBe("text1.x.baseVal.numberOfItems", "3");
157
    shouldBe("text1.x.baseVal.numberOfItems", "3");
150
    shouldBeEqualToString("text1.getAttribute('x')", "1 3 2");
158
    shouldBeEqualToString("text1.getAttribute('x')", "1 3 2");
151
    shouldThrow("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 4)");
159
    shouldThrow("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(3), 4)");
Lines 157-173 a/LayoutTests/svg/dom/SVGLengthList-basics.xhtml_sec7
157
    debug("");
165
    debug("");
158
    debug("Test overlapping edge cases for replaceItem()");
166
    debug("Test overlapping edge cases for replaceItem()");
159
    var item = text1.x.baseVal.getItem(3);
167
    var item = text1.x.baseVal.getItem(3);
160
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 3)", "text1.x.baseVal.getItem(2)");
168
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 3)", "text1.x.baseVal.getItem(3)");
169
    shouldBeEqualToString("text1.x.baseVal.removeItem(0).toString()", "[object SVGLength]");
161
    shouldBe("text1.x.baseVal.numberOfItems", "3");    
170
    shouldBe("text1.x.baseVal.numberOfItems", "3");    
162
    item = text1.x.baseVal.getItem(2);
171
    item = text1.x.baseVal.getItem(2);
163
    item.newValueSpecifiedUnits(item.unitType, item.value * 2);
172
    item.newValueSpecifiedUnits(item.unitType, item.value * 2);
164
    shouldBe("text1.x.baseVal.getItem(2).value", "2");
173
    shouldBe("text1.x.baseVal.getItem(2).value", "2");
165
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 2)", "text1.x.baseVal.getItem(1)");
174
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 2)", "text1.x.baseVal.getItem(2)");
175
    shouldBeEqualToString("text1.x.baseVal.removeItem(0).toString()", "[object SVGLength]");
166
    shouldBe("text1.x.baseVal.numberOfItems", "2");
176
    shouldBe("text1.x.baseVal.numberOfItems", "2");
167
    item = text1.x.baseVal.getItem(1);
177
    item = text1.x.baseVal.getItem(1);
168
    item.newValueSpecifiedUnits(item.unitType, item.value * 2);
178
    item.newValueSpecifiedUnits(item.unitType, item.value * 2);
169
    shouldBe("text1.x.baseVal.getItem(1).value", "4");
179
    shouldBe("text1.x.baseVal.getItem(1).value", "4");
170
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 1)", "text1.x.baseVal.getItem(0)");
180
    shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 1)", "text1.x.baseVal.getItem(1)");
181
    shouldBeEqualToString("text1.x.baseVal.removeItem(1).toString()", "[object SVGLength]");
171
    shouldBe("text1.x.baseVal.numberOfItems", "1");
182
    shouldBe("text1.x.baseVal.numberOfItems", "1");
172
    item = text1.x.baseVal.getItem(0);
183
    item = text1.x.baseVal.getItem(0);
173
    item.newValueSpecifiedUnits(item.unitType, item.value * 2);
184
    item.newValueSpecifiedUnits(item.unitType, item.value * 2);
- a/LayoutTests/svg/dom/SVGLengthList-initialize-expected.txt -2 / +4 lines
Lines 45-51 PASS text2.x.baseVal.getItem(1).value is 500 a/LayoutTests/svg/dom/SVGLengthList-initialize-expected.txt_sec1
45
PASS text2.x.baseVal.getItem(1).value is 50
45
PASS text2.x.baseVal.getItem(1).value is 50
46
46
47
Override the third text elements x list with the item x=50 from the second text element, where it should be removed afterwards
47
Override the third text elements x list with the item x=50 from the second text element, where it should be removed afterwards
48
PASS text3.x.baseVal.initialize(itemInAnotherList) is itemInAnotherList
48
PASS text3.x.baseVal.initialize(itemInAnotherList) is text3.x.baseVal.getItem(0)
49
PASS text2.x.baseVal.removeItem(1).toString() is "[object SVGLength]"
49
PASS text3.x.baseVal.getItem(0).value is 50
50
PASS text3.x.baseVal.getItem(0).value is 50
50
PASS text2.x.baseVal.getItem(0).value is 50
51
PASS text2.x.baseVal.getItem(0).value is 50
51
PASS text2.x.baseVal.getItem(1) threw exception IndexSizeError: The index is not in the allowed range..
52
PASS text2.x.baseVal.getItem(1) threw exception IndexSizeError: The index is not in the allowed range..
Lines 59-65 PASS itemInAnotherList.value is 50 a/LayoutTests/svg/dom/SVGLengthList-initialize-expected.txt_sec2
59
PASS text3.x.baseVal.getItem(0).value is 50
60
PASS text3.x.baseVal.getItem(0).value is 50
60
61
61
Move item from text3 to text4
62
Move item from text3 to text4
62
PASS text4.x.baseVal.initialize(text3.x.baseVal.getItem(0)) is itemInAnotherList
63
PASS text4.x.baseVal.initialize(text3.x.baseVal.getItem(0)) is text4.x.baseVal.getItem(0)
64
PASS text3.x.baseVal.removeItem(0).toString() is "[object SVGLength]"
63
PASS text4.x.baseVal.getItem(0).value is 50
65
PASS text4.x.baseVal.getItem(0).value is 50
64
PASS text3.x.baseVal.getItem(0) threw exception IndexSizeError: The index is not in the allowed range..
66
PASS text3.x.baseVal.getItem(0) threw exception IndexSizeError: The index is not in the allowed range..
65
67
- a/LayoutTests/svg/dom/SVGLengthList-initialize.xhtml -4 / +6 lines
Lines 71-81 a/LayoutTests/svg/dom/SVGLengthList-initialize.xhtml_sec1
71
    itemInAnotherList.value = 50;
71
    itemInAnotherList.value = 50;
72
    shouldBe("text2.x.baseVal.getItem(1).value", "50");
72
    shouldBe("text2.x.baseVal.getItem(1).value", "50");
73
73
74
    // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list.
74
    // Spec: If the inserted item is already in a list, a copy of the item will be inserted.
75
    //       The inserted item is the item itself and not a copy.
76
    debug("");
75
    debug("");
77
    debug("Override the third text elements x list with the item x=50 from the second text element, where it should be removed afterwards");
76
    debug("Override the third text elements x list with the item x=50 from the second text element, where it should be removed afterwards");
78
    shouldBe("text3.x.baseVal.initialize(itemInAnotherList)", "itemInAnotherList");
77
    shouldBe("text3.x.baseVal.initialize(itemInAnotherList)", "text3.x.baseVal.getItem(0)");
78
    shouldBeEqualToString("text2.x.baseVal.removeItem(1).toString()", "[object SVGLength]");
79
    itemInAnotherList = text3.x.baseVal.getItem(0);
79
    shouldBe("text3.x.baseVal.getItem(0).value", "50");
80
    shouldBe("text3.x.baseVal.getItem(0).value", "50");
80
    shouldBe("text2.x.baseVal.getItem(0).value", "50");
81
    shouldBe("text2.x.baseVal.getItem(0).value", "50");
81
    shouldThrow("text2.x.baseVal.getItem(1)");
82
    shouldThrow("text2.x.baseVal.getItem(1)");
Lines 91-97 a/LayoutTests/svg/dom/SVGLengthList-initialize.xhtml_sec2
91
92
92
    debug("");
93
    debug("");
93
    debug("Move item from text3 to text4");
94
    debug("Move item from text3 to text4");
94
    shouldBe("text4.x.baseVal.initialize(text3.x.baseVal.getItem(0))", "itemInAnotherList");
95
    shouldBe("text4.x.baseVal.initialize(text3.x.baseVal.getItem(0))", "text4.x.baseVal.getItem(0)");
96
    shouldBeEqualToString("text3.x.baseVal.removeItem(0).toString()", "[object SVGLength]");
95
    shouldBe("text4.x.baseVal.getItem(0).value", "50");
97
    shouldBe("text4.x.baseVal.getItem(0).value", "50");
96
    shouldThrow("text3.x.baseVal.getItem(0)");
98
    shouldThrow("text3.x.baseVal.getItem(0)");
97
99
- a/LayoutTests/svg/dom/SVGLengthList-insertItemBefore-expected.txt -2 / +4 lines
Lines 62-68 PASS text1.x.baseVal.getItem(5).value is 50 a/LayoutTests/svg/dom/SVGLengthList-insertItemBefore-expected.txt_sec1
62
PASS text1.x.baseVal.getItem(6) threw exception IndexSizeError: The index is not in the allowed range..
62
PASS text1.x.baseVal.getItem(6) threw exception IndexSizeError: The index is not in the allowed range..
63
63
64
Insert item 'newLength3' at position=1, between '100' and '500', remove it from the old position=2 afterwards.
64
Insert item 'newLength3' at position=1, between '100' and '500', remove it from the old position=2 afterwards.
65
PASS text1.x.baseVal.insertItemBefore(newLength3, 1) is newLength3
65
PASS text1.x.baseVal.insertItemBefore(newLength3, 1) is text1.x.baseVal.getItem(1)
66
PASS text1.x.baseVal.removeItem(3).toString() is "[object SVGLength]"
66
PASS text1.x.baseVal.numberOfItems is 6
67
PASS text1.x.baseVal.numberOfItems is 6
67
PASS text1.x.baseVal.getItem(0).value is 100
68
PASS text1.x.baseVal.getItem(0).value is 100
68
PASS text1.x.baseVal.getItem(1).value is 150
69
PASS text1.x.baseVal.getItem(1).value is 150
Lines 73-79 PASS text1.x.baseVal.getItem(5).value is 50 a/LayoutTests/svg/dom/SVGLengthList-insertItemBefore-expected.txt_sec2
73
PASS text1.x.baseVal.getItem(6) threw exception IndexSizeError: The index is not in the allowed range..
74
PASS text1.x.baseVal.getItem(6) threw exception IndexSizeError: The index is not in the allowed range..
74
75
75
Insert item 'newLength3' at position=0, before '100', remove it from the old position=5 afterwards.
76
Insert item 'newLength3' at position=0, before '100', remove it from the old position=5 afterwards.
76
PASS text1.x.baseVal.insertItemBefore(newLength1, 0) is newLength1
77
PASS text1.x.baseVal.insertItemBefore(newLength1, 0) is text1.x.baseVal.getItem(0)
78
PASS text1.x.baseVal.removeItem(6).toString() is "[object SVGLength]"
77
PASS text1.x.baseVal.numberOfItems is 6
79
PASS text1.x.baseVal.numberOfItems is 6
78
PASS text1.x.baseVal.getItem(0).value is 50
80
PASS text1.x.baseVal.getItem(0).value is 50
79
PASS text1.x.baseVal.getItem(1).value is 100
81
PASS text1.x.baseVal.getItem(1).value is 100
- a/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.xhtml -4 / +5 lines
Lines 96-106 a/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.xhtml_sec1
96
    shouldBe("text1.x.baseVal.getItem(5).value", "50");
96
    shouldBe("text1.x.baseVal.getItem(5).value", "50");
97
    shouldThrow("text1.x.baseVal.getItem(6)");
97
    shouldThrow("text1.x.baseVal.getItem(6)");
98
98
99
    // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
99
    // Spec: If newItem is already in a list, a clone of newItem inserted into this list.
100
    // Spec: If the item is already in this list, note that the index of the item to insert before is before the removal of the item. 
101
    debug("");
100
    debug("");
102
    debug("Insert item 'newLength3' at position=1, between '100' and '500', remove it from the old position=2 afterwards.");
101
    debug("Insert item 'newLength3' at position=1, between '100' and '500', remove it from the old position=2 afterwards.");
103
    shouldBe("text1.x.baseVal.insertItemBefore(newLength3, 1)", "newLength3");
102
    shouldBe("text1.x.baseVal.insertItemBefore(newLength3, 1)", "text1.x.baseVal.getItem(1)");
103
    shouldBeEqualToString("text1.x.baseVal.removeItem(3).toString()", "[object SVGLength]");
104
    shouldBe("text1.x.baseVal.numberOfItems", "6");
104
    shouldBe("text1.x.baseVal.numberOfItems", "6");
105
    shouldBe("text1.x.baseVal.getItem(0).value", "100");
105
    shouldBe("text1.x.baseVal.getItem(0).value", "100");
106
    shouldBe("text1.x.baseVal.getItem(1).value", "150");
106
    shouldBe("text1.x.baseVal.getItem(1).value", "150");
Lines 112-118 a/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.xhtml_sec2
112
112
113
    debug("");
113
    debug("");
114
    debug("Insert item 'newLength3' at position=0, before '100', remove it from the old position=5 afterwards.");
114
    debug("Insert item 'newLength3' at position=0, before '100', remove it from the old position=5 afterwards.");
115
    shouldBe("text1.x.baseVal.insertItemBefore(newLength1, 0)", "newLength1");
115
    shouldBe("text1.x.baseVal.insertItemBefore(newLength1, 0)", "text1.x.baseVal.getItem(0)");
116
    shouldBeEqualToString("text1.x.baseVal.removeItem(6).toString()", "[object SVGLength]");
116
    shouldBe("text1.x.baseVal.numberOfItems", "6");
117
    shouldBe("text1.x.baseVal.numberOfItems", "6");
117
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
118
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
118
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
119
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
- a/LayoutTests/svg/dom/SVGLengthList-removeItem-expected.txt -2 / +10 lines
Lines 27-33 PASS text2.x.baseVal.getItem(2).value is 1000 a/LayoutTests/svg/dom/SVGLengthList-removeItem-expected.txt_sec1
27
PASS text2.x.baseVal.getItem(3) threw exception IndexSizeError: The index is not in the allowed range..
27
PASS text2.x.baseVal.getItem(3) threw exception IndexSizeError: The index is not in the allowed range..
28
28
29
Append fourth item x=900 to the text1 x list
29
Append fourth item x=900 to the text1 x list
30
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3)) is text1.x.baseVal.getItem(4)
30
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3)) is text1.x.baseVal.getItem(5)
31
PASS text1.x.baseVal.removeItem(3).toString() is "[object SVGLength]"
31
PASS text1.x.baseVal.numberOfItems is 5
32
PASS text1.x.baseVal.numberOfItems is 5
32
PASS text1.x.baseVal.getItem(0).value is 500
33
PASS text1.x.baseVal.getItem(0).value is 500
33
PASS text1.x.baseVal.getItem(1).value is 50
34
PASS text1.x.baseVal.getItem(1).value is 50
Lines 37-43 PASS text1.x.baseVal.getItem(4).value is 900 a/LayoutTests/svg/dom/SVGLengthList-removeItem-expected.txt_sec2
37
PASS text1.x.baseVal.getItem(5) threw exception IndexSizeError: The index is not in the allowed range..
38
PASS text1.x.baseVal.getItem(5) threw exception IndexSizeError: The index is not in the allowed range..
38
39
39
Append first item x=500 to the text1 x list
40
Append first item x=500 to the text1 x list
40
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0)) is text1.x.baseVal.getItem(4)
41
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0)) is text1.x.baseVal.getItem(5)
42
PASS text1.x.baseVal.removeItem(0).toString() is "[object SVGLength]"
41
PASS text1.x.baseVal.numberOfItems is 5
43
PASS text1.x.baseVal.numberOfItems is 5
42
PASS text1.x.baseVal.getItem(0).value is 50
44
PASS text1.x.baseVal.getItem(0).value is 50
43
PASS text1.x.baseVal.getItem(1).value is 100
45
PASS text1.x.baseVal.getItem(1).value is 100
Lines 59-65 PASS text1.x.baseVal.getItem(6) threw exception IndexSizeError: The index is not a/LayoutTests/svg/dom/SVGLengthList-removeItem-expected.txt_sec3
59
61
60
Append third and fourth item of the text1 x list to the text2 x list
62
Append third and fourth item of the text1 x list to the text2 x list
61
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 1000
63
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 1000
64
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
62
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 900
65
PASS text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 900
66
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
63
PASS text1.x.baseVal.numberOfItems is 4
67
PASS text1.x.baseVal.numberOfItems is 4
64
PASS text1.x.baseVal.getItem(0).value is 50
68
PASS text1.x.baseVal.getItem(0).value is 50
65
PASS text1.x.baseVal.getItem(1).value is 100
69
PASS text1.x.baseVal.getItem(1).value is 100
Lines 77-86 PASS newLength2.value is 150 a/LayoutTests/svg/dom/SVGLengthList-removeItem-expected.txt_sec4
77
81
78
Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists
82
Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists
79
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 500
83
PASS text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value is 500
84
PASS text1.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
80
PASS text2.x.baseVal.appendItem(newLength2).value is 150
85
PASS text2.x.baseVal.appendItem(newLength2).value is 150
81
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
86
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
87
PASS text2.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
82
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value is 900
88
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value is 900
89
PASS text2.x.baseVal.removeItem(3).toString() is "[object SVGLength]"
83
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
90
PASS text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value is 1000
91
PASS text2.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
84
PASS text1.x.baseVal.numberOfItems is 4
92
PASS text1.x.baseVal.numberOfItems is 4
85
PASS text1.x.baseVal.getItem(0).value is 50
93
PASS text1.x.baseVal.getItem(0).value is 50
86
PASS text1.x.baseVal.getItem(1).value is 100
94
PASS text1.x.baseVal.getItem(1).value is 100
- a/LayoutTests/svg/dom/SVGLengthList-removeItem.xhtml -2 / +10 lines
Lines 46-52 a/LayoutTests/svg/dom/SVGLengthList-removeItem.xhtml_sec1
46
46
47
    debug("");
47
    debug("");
48
    debug("Append fourth item x=900 to the text1 x list");
48
    debug("Append fourth item x=900 to the text1 x list");
49
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3))", "text1.x.baseVal.getItem(4)");
49
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(3))", "text1.x.baseVal.getItem(5)");
50
    shouldBeEqualToString("text1.x.baseVal.removeItem(3).toString()", "[object SVGLength]");
50
    shouldBe("text1.x.baseVal.numberOfItems", "5");
51
    shouldBe("text1.x.baseVal.numberOfItems", "5");
51
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
52
    shouldBe("text1.x.baseVal.getItem(0).value", "500");
52
    shouldBe("text1.x.baseVal.getItem(1).value", "50");
53
    shouldBe("text1.x.baseVal.getItem(1).value", "50");
Lines 57-63 a/LayoutTests/svg/dom/SVGLengthList-removeItem.xhtml_sec2
57
58
58
    debug("");
59
    debug("");
59
    debug("Append first item x=500 to the text1 x list");
60
    debug("Append first item x=500 to the text1 x list");
60
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0))", "text1.x.baseVal.getItem(4)");
61
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(0))", "text1.x.baseVal.getItem(5)");
62
    shouldBeEqualToString("text1.x.baseVal.removeItem(0).toString()", "[object SVGLength]");
61
    shouldBe("text1.x.baseVal.numberOfItems", "5");
63
    shouldBe("text1.x.baseVal.numberOfItems", "5");
62
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
64
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
63
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
65
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
Lines 81-87 a/LayoutTests/svg/dom/SVGLengthList-removeItem.xhtml_sec3
81
    debug("");
83
    debug("");
82
    debug("Append third and fourth item of the text1 x list to the text2 x list");
84
    debug("Append third and fourth item of the text1 x list to the text2 x list");
83
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "1000");
85
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "1000");
86
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
84
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "900");
87
    shouldBe("text2.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "900");
88
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
85
    shouldBe("text1.x.baseVal.numberOfItems", "4");
89
    shouldBe("text1.x.baseVal.numberOfItems", "4");
86
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
90
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
87
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
91
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
Lines 103-112 a/LayoutTests/svg/dom/SVGLengthList-removeItem.xhtml_sec4
103
    debug("");
107
    debug("");
104
    debug("Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists");
108
    debug("Shuffle around items in text1 and text2 list using appendItem, to get x=50,100,150,... in both lists");
105
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "500");
109
    shouldBe("text1.x.baseVal.appendItem(text1.x.baseVal.getItem(2)).value", "500");
110
    shouldBeEqualToString("text1.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
106
    shouldBe("text2.x.baseVal.appendItem(newLength2).value", "150");
111
    shouldBe("text2.x.baseVal.appendItem(newLength2).value", "150");
107
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
112
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
113
    shouldBeEqualToString("text2.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
108
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value", "900");
114
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(3)).value", "900");
115
    shouldBeEqualToString("text2.x.baseVal.removeItem(3).toString()", "[object SVGLength]");
109
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
116
    shouldBe("text2.x.baseVal.appendItem(text2.x.baseVal.getItem(2)).value", "1000");
117
    shouldBeEqualToString("text2.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
110
    shouldBe("text1.x.baseVal.numberOfItems", "4");
118
    shouldBe("text1.x.baseVal.numberOfItems", "4");
111
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
119
    shouldBe("text1.x.baseVal.getItem(0).value", "50");
112
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
120
    shouldBe("text1.x.baseVal.getItem(1).value", "100");
- a/LayoutTests/svg/dom/SVGLengthList-replaceItem-expected.txt +3 lines
Lines 46-51 PASS text2.x.baseVal.getItem(4) threw exception IndexSizeError: The index is not a/LayoutTests/svg/dom/SVGLengthList-replaceItem-expected.txt_sec1
46
46
47
Replace the first item in text2 x list with the third item in the list
47
Replace the first item in text2 x list with the third item in the list
48
PASS text2.x.baseVal.replaceItem(text2.x.baseVal.getItem(2), 0).value is 50
48
PASS text2.x.baseVal.replaceItem(text2.x.baseVal.getItem(2), 0).value is 50
49
PASS text2.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
49
PASS text2.x.baseVal.numberOfItems is 3
50
PASS text2.x.baseVal.numberOfItems is 3
50
PASS text2.x.baseVal.getItem(0).value is 50
51
PASS text2.x.baseVal.getItem(0).value is 50
51
PASS text2.x.baseVal.getItem(1).value is 100
52
PASS text2.x.baseVal.getItem(1).value is 100
Lines 70-75 PASS text4.x.baseVal.getItem(4) threw exception IndexSizeError: The index is not a/LayoutTests/svg/dom/SVGLengthList-replaceItem-expected.txt_sec2
70
71
71
Replace the first item in text4 x list with the second item in the text3 x list
72
Replace the first item in text4 x list with the second item in the text3 x list
72
PASS text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(1), 0).value is 50
73
PASS text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(1), 0).value is 50
74
PASS text3.x.baseVal.removeItem(1).toString() is "[object SVGLength]"
73
PASS text3.x.baseVal.numberOfItems is 4
75
PASS text3.x.baseVal.numberOfItems is 4
74
PASS text3.x.baseVal.getItem(0).value is 50
76
PASS text3.x.baseVal.getItem(0).value is 50
75
PASS text3.x.baseVal.getItem(1).value is 100
77
PASS text3.x.baseVal.getItem(1).value is 100
Lines 85-90 PASS text4.x.baseVal.getItem(4) threw exception IndexSizeError: The index is not a/LayoutTests/svg/dom/SVGLengthList-replaceItem-expected.txt_sec3
85
87
86
Replace the second item in text4 x list with the second item in the text4 x list
88
Replace the second item in text4 x list with the second item in the text4 x list
87
PASS text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(2), 1).value is 100
89
PASS text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(2), 1).value is 100
90
PASS text3.x.baseVal.removeItem(2).toString() is "[object SVGLength]"
88
PASS text4.x.baseVal.numberOfItems is 4
91
PASS text4.x.baseVal.numberOfItems is 4
89
PASS text4.x.baseVal.getItem(0).value is 50
92
PASS text4.x.baseVal.getItem(0).value is 50
90
PASS text4.x.baseVal.getItem(1).value is 100
93
PASS text4.x.baseVal.getItem(1).value is 100
- a/LayoutTests/svg/dom/SVGLengthList-replaceItem.xhtml +3 lines
Lines 75-80 a/LayoutTests/svg/dom/SVGLengthList-replaceItem.xhtml_sec1
75
    debug("");
75
    debug("");
76
    debug("Replace the first item in text2 x list with the third item in the list");
76
    debug("Replace the first item in text2 x list with the third item in the list");
77
    shouldBe("text2.x.baseVal.replaceItem(text2.x.baseVal.getItem(2), 0).value", "50");
77
    shouldBe("text2.x.baseVal.replaceItem(text2.x.baseVal.getItem(2), 0).value", "50");
78
    shouldBeEqualToString("text2.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
78
    shouldBe("text2.x.baseVal.numberOfItems", "3");
79
    shouldBe("text2.x.baseVal.numberOfItems", "3");
79
    shouldBe("text2.x.baseVal.getItem(0).value", "50");
80
    shouldBe("text2.x.baseVal.getItem(0).value", "50");
80
    shouldBe("text2.x.baseVal.getItem(1).value", "100");
81
    shouldBe("text2.x.baseVal.getItem(1).value", "100");
Lines 102-107 a/LayoutTests/svg/dom/SVGLengthList-replaceItem.xhtml_sec2
102
    debug("");
103
    debug("");
103
    debug("Replace the first item in text4 x list with the second item in the text3 x list");
104
    debug("Replace the first item in text4 x list with the second item in the text3 x list");
104
    shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(1), 0).value", "50");
105
    shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(1), 0).value", "50");
106
    shouldBeEqualToString("text3.x.baseVal.removeItem(1).toString()", "[object SVGLength]");
105
    shouldBe("text3.x.baseVal.numberOfItems", "4");
107
    shouldBe("text3.x.baseVal.numberOfItems", "4");
106
    shouldBe("text3.x.baseVal.getItem(0).value", "50");
108
    shouldBe("text3.x.baseVal.getItem(0).value", "50");
107
    shouldBe("text3.x.baseVal.getItem(1).value", "100");
109
    shouldBe("text3.x.baseVal.getItem(1).value", "100");
Lines 118-123 a/LayoutTests/svg/dom/SVGLengthList-replaceItem.xhtml_sec3
118
    debug("");
120
    debug("");
119
    debug("Replace the second item in text4 x list with the second item in the text4 x list");
121
    debug("Replace the second item in text4 x list with the second item in the text4 x list");
120
    shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(2), 1).value", "100");
122
    shouldBe("text4.x.baseVal.replaceItem(text3.x.baseVal.getItem(2), 1).value", "100");
123
    shouldBeEqualToString("text3.x.baseVal.removeItem(2).toString()", "[object SVGLength]");
121
    shouldBe("text4.x.baseVal.numberOfItems", "4");
124
    shouldBe("text4.x.baseVal.numberOfItems", "4");
122
    shouldBe("text4.x.baseVal.getItem(0).value", "50");
125
    shouldBe("text4.x.baseVal.getItem(0).value", "50");
123
    shouldBe("text4.x.baseVal.getItem(1).value", "100");
126
    shouldBe("text4.x.baseVal.getItem(1).value", "100");

Return to Bug 196083