12019-03-13 Said Abou-Hallawa <said@apple.com>
2
3 Remove the SVG property tear off objects for SVGAnimatedInteger
4 https://bugs.webkit.org/show_bug.cgi?id=195722
5
6 Reviewed by NOBODY (OOPS!).
7
8 Instead of saving a raw integer value in the SVGElement and then wrapping
9 the pointer to this raw data in a tear off object, we will represent the
10 integer as Ref<SVGAnimatedInteger> in SVGElement. This will make the
11 representation of the property in IDL file matches the C++ header file.
12
13 When the DOM requesting the SVGAnimatedInteger, we get return a reference
14 to the new animated property. When the rendering code asks for the current
15 value of the this animated property, we return the animVal() or the
16 baseVal() which will depend on whether the property is animating or not.
17
18 A pointer to a member in the SVGElement will be registered along with the
19 associated attribute name in SVGPropertyRegistry. Registering the property
20 creates an SVGAccessor and links to the associated attribute. The function
21 of the SVGAccessor is to retrieve the value of the property given a pointer
22 to an SVGElement.
23
24 SVGPropertyRegistry manages all the properties of SVGElement. It takes
25 into account the inherited properties as well.
26
27 SVGElement will have a virtual method called propertyRegistry(). Every
28 superclass will override this method to return a reference to its registry
29 which includes all the registered properties of this class and its bases.
30
31 One important function of the SVGPropertyRegistry and SVGAccessor is they
32 create the appropriate SVGAnimator for this property.
33
34 SVGAnimator is just a connection between the animated property and
35 SVGAnimationFunction. SVGAnimationFunction calculates the values of the
36 animated property within a time interval. SVGAnimator updates animVal
37 of the animated property and invalidates the associated SVGElement and
38 all the instances that references this element.
39
40 The plan is to remove all the SVG tear off objects like what this patch
41 does for SVGAnimatedInteger. So for a period of time the old code and the
42 new code will co-exist together. To get the code complied and linked,
43 some code has to be moved around and new classes have to have awkward
44 names till the tear off properties code is completely deleted.
45
46 Things to consider when reviewing this patch:
47
48 -- SVGNewProperty.h will replace SVGProperty.h
49
50 -- SVGNewAnimatedProperty.h will replace SVGAnimatedProperty.h
51
52 -- SVGAnimatedElementBase was re-factored to use SVGAnimationControllerBase
53 which is inherited by SVGAnimationController and SVGNewAnimationController.
54 The tear-off properties code which uses SVGAnimatedType now lives in
55 SVGAnimationController. The new code was added to SVGNewAnimationController.
56 The plan is to remove the three animation controllers and to move the code
57 of SVGNewAnimationController to SVGAnimatedElementBase when all the tear
58 off code is removed.
59
60 -- SVGElement now keeps two registries one for the tear-off world and the
61 other for the new world. Eventually we need to get rid of tear-off registry.
62
63 -- SVGElement will differentiate between the type of the property by the
64 the method isAnimatedAttribute().
65
66 * Sources.txt:
67 * WebCore.xcodeproj/project.pbxproj:
68 * bindings/scripts/CodeGeneratorJS.pm:
69 (GenerateHeader):
70 * svg/SVGAnimateElementBase.cpp:
71 (WebCore::SVGAnimateElementBase::SVGAnimateElementBase):
72 (WebCore::SVGAnimateElementBase::ensureController):
73 (WebCore::SVGAnimateElementBase::hasValidAttributeType const):
74 (WebCore::SVGAnimateElementBase::determineAnimatedPropertyType const):
75 (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
76 (WebCore::SVGAnimateElementBase::calculateToAtEndOfDurationValue):
77 (WebCore::SVGAnimateElementBase::calculateFromAndToValues):
78 (WebCore::SVGAnimateElementBase::calculateFromAndByValues):
79 (WebCore::SVGAnimateElementBase::resetAnimatedType):
80 (WebCore::SVGAnimateElementBase::clearAnimatedType):
81 (WebCore::SVGAnimateElementBase::applyResultsToTarget):
82 (WebCore::SVGAnimateElementBase::isAdditive const):
83 (WebCore::SVGAnimateElementBase::calculateDistance):
84 (WebCore::SVGAnimateElementBase::setTargetElement):
85 (WebCore::SVGAnimateElementBase::setAttributeName):
86 (WebCore::SVGAnimateElementBase::resetAnimation):
87 (WebCore::SVGAnimateElementBase::hasInvalidCSSAttributeType const):
88 (WebCore::SVGAnimateElementBase::hasValidAttributeType): Deleted.
89 (WebCore::propertyTypesAreConsistent): Deleted.
90 (WebCore::applyCSSPropertyToTarget): Deleted.
91 (WebCore::removeCSSPropertyFromTarget): Deleted.
92 (WebCore::applyCSSPropertyToTargetAndInstances): Deleted.
93 (WebCore::removeCSSPropertyFromTargetAndInstances): Deleted.
94 (WebCore::notifyTargetAboutAnimValChange): Deleted.
95 (WebCore::notifyTargetAndInstancesAboutAnimValChange): Deleted.
96 (WebCore::SVGAnimateElementBase::animatedPropertyTypeSupportsAddition const): Deleted.
97 (WebCore::SVGAnimateElementBase::resetAnimatedPropertyType): Deleted.
98 (WebCore::SVGAnimateElementBase::ensureAnimator): Deleted.
99 * svg/SVGAnimateElementBase.h:
100 * svg/SVGAnimateMotionElement.cpp:
101 (WebCore::SVGAnimateMotionElement::hasValidAttributeType const):
102 (WebCore::SVGAnimateMotionElement::hasValidAttributeName const):
103 (WebCore::SVGAnimateMotionElement::calculateFromAndByValues):
104 (WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
105 (WebCore::SVGAnimateMotionElement::updateAnimationMode):
106 (WebCore::SVGAnimateMotionElement::hasValidAttributeType): Deleted.
107 (WebCore::SVGAnimateMotionElement::hasValidAttributeName): Deleted.
108 * svg/SVGAnimateMotionElement.h:
109 * svg/SVGAnimateTransformElement.cpp:
110 (WebCore::SVGAnimateTransformElement::hasValidAttributeType const):
111 (WebCore::SVGAnimateTransformElement::hasValidAttributeType): Deleted.
112 * svg/SVGAnimateTransformElement.h:
113 * svg/SVGAnimatedAngle.cpp:
114 (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
115 * svg/SVGAnimatedBoolean.cpp:
116 (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
117 * svg/SVGAnimatedColor.cpp:
118 (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
119 * svg/SVGAnimatedEnumeration.cpp:
120 (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
121 * svg/SVGAnimatedInteger.cpp: Removed.
122 * svg/SVGAnimatedInteger.h: Removed.
123 * svg/SVGAnimatedIntegerOptionalInteger.cpp: Removed.
124 * svg/SVGAnimatedIntegerOptionalInteger.h: Removed.
125 * svg/SVGAnimatedLength.cpp:
126 (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
127 * svg/SVGAnimatedLengthList.cpp:
128 (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
129 * svg/SVGAnimatedNumber.cpp:
130 (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
131 * svg/SVGAnimatedNumberList.cpp:
132 (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
133 * svg/SVGAnimatedNumberOptionalNumber.cpp:
134 (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
135 * svg/SVGAnimatedPath.cpp:
136 (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
137 * svg/SVGAnimatedPointList.cpp:
138 (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
139 * svg/SVGAnimatedPointList.h:
140 * svg/SVGAnimatedPreserveAspectRatio.cpp:
141 (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
142 * svg/SVGAnimatedRect.cpp:
143 (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
144 * svg/SVGAnimatedTransformList.cpp:
145 (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
146 * svg/SVGAnimationController.cpp: Copied from Source/WebCore/svg/SVGAnimateElementBase.cpp.
147 (WebCore::SVGAnimationController::SVGAnimationController):
148 (WebCore::SVGAnimationController::ensureAnimator):
149 (WebCore::SVGAnimationController::isAdditive const):
150 (WebCore::SVGAnimationController::hasValidAttributeType const):
151 (WebCore::SVGAnimationController::calculateFromAndToValues):
152 (WebCore::SVGAnimationController::calculateFromAndByValues):
153 (WebCore::SVGAnimationController::calculateToAtEndOfDurationValue):
154 (WebCore::propertyTypesAreConsistent):
155 (WebCore::SVGAnimationController::resetAnimatedType):
156 (WebCore::SVGAnimationController::calculateAnimatedValue):
157 (WebCore::applyCSSPropertyToTarget):
158 (WebCore::removeCSSPropertyFromTarget):
159 (WebCore::applyCSSPropertyToTargetAndInstances):
160 (WebCore::removeCSSPropertyFromTargetAndInstances):
161 (WebCore::notifyTargetAboutAnimValChange):
162 (WebCore::notifyTargetAndInstancesAboutAnimValChange):
163 (WebCore::SVGAnimationController::applyResultsToTarget):
164 (WebCore::SVGAnimationController::clearAnimatedType):
165 (WebCore::SVGAnimationController::calculateDistance):
166 * svg/SVGAnimationController.h: Added.
167 * svg/SVGAnimationControllerBase.cpp: Added.
168 (WebCore::SVGAnimationControllerBase::SVGAnimationControllerBase):
169 (WebCore::SVGAnimationControllerBase::determineAnimatedPropertyType):
170 * svg/SVGAnimationControllerBase.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h.
171 * svg/SVGAnimationElement.cpp:
172 (WebCore::SVGAnimationElement::updateAnimationMode):
173 (WebCore::SVGAnimationElement::setAttributeType):
174 (WebCore::SVGAnimationElement::isAdditive const):
175 (WebCore::SVGAnimationElement::isAccumulated const):
176 (WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced):
177 (WebCore::SVGAnimationElement::startedActiveInterval):
178 (WebCore::SVGAnimationElement::updateAnimation):
179 (WebCore::SVGAnimationElement::resetAnimation):
180 (WebCore::SVGAnimationElement::resetAnimatedPropertyType): Deleted.
181 (WebCore::SVGAnimationElement::setTargetElement): Deleted.
182 (WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): Deleted.
183 * svg/SVGAnimationElement.h:
184 (WebCore::SVGAnimationElement::adjustFromToListValues):
185 (WebCore::SVGAnimationElement::animateDiscreteType):
186 (WebCore::SVGAnimationElement::animateAdditiveNumber):
187 (WebCore::SVGAnimationElement::attributeType const):
188 (WebCore::SVGAnimationElement::hasInvalidCSSAttributeType const): Deleted.
189 * svg/SVGAnimatorFactory.h:
190 (WebCore::SVGAnimatorFactory::create):
191 * svg/SVGElement.cpp:
192 (WebCore::SVGElement::synchronizeAllAnimatedSVGAttribute):
193 (WebCore::SVGElement::synchronizeAnimatedSVGAttribute const):
194 (WebCore::SVGElement::commitPropertyChange):
195 (WebCore::SVGElement::isAnimatedPropertyAttribute const):
196 (WebCore::SVGElement::isAnimatedAttribute const):
197 (WebCore::SVGElement::createAnimator):
198 * svg/SVGElement.h:
199 (WebCore::SVGElement::propertyRegistry const):
200 * svg/SVGFEConvolveMatrixElement.cpp:
201 (WebCore::SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement):
202 (WebCore::SVGFEConvolveMatrixElement::registerAttributes):
203 (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
204 (WebCore::SVGFEConvolveMatrixElement::setOrder):
205 (WebCore::SVGFEConvolveMatrixElement::orderXIdentifier): Deleted.
206 (WebCore::SVGFEConvolveMatrixElement::orderYIdentifier): Deleted.
207 * svg/SVGFEConvolveMatrixElement.h:
208 * svg/SVGFETurbulenceElement.cpp:
209 (WebCore::SVGFETurbulenceElement::SVGFETurbulenceElement):
210 (WebCore::SVGFETurbulenceElement::registerAttributes):
211 (WebCore::SVGFETurbulenceElement::parseAttribute):
212 * svg/SVGFETurbulenceElement.h:
213 * svg/SVGFilterElement.h:
214 * svg/SVGNewAnimationController.cpp: Added.
215 (WebCore::SVGNewAnimationController::SVGNewAnimationController):
216 (WebCore::SVGNewAnimationController::createAnimator const):
217 (WebCore::SVGNewAnimationController::isDiscreteAnimator const):
218 (WebCore::SVGNewAnimationController::isAdditive const):
219 (WebCore::SVGNewAnimationController::hasValidAttributeType const):
220 (WebCore::SVGNewAnimationController::calculateFromAndToValues):
221 (WebCore::SVGNewAnimationController::calculateFromAndByValues):
222 (WebCore::SVGNewAnimationController::calculateToAtEndOfDurationValue):
223 (WebCore::SVGNewAnimationController::resetAnimatedType):
224 (WebCore::SVGNewAnimationController::calculateAnimatedValue):
225 (WebCore::SVGNewAnimationController::applyResultsToTarget):
226 (WebCore::SVGNewAnimationController::clearAnimatedType):
227 (WebCore::SVGNewAnimationController::calculateDistance):
228 * svg/SVGNewAnimationController.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h.
229 * svg/SVGSetElement.cpp:
230 (WebCore::SVGSetElement::SVGSetElement):
231 * svg/animation/SVGSMILElement.cpp:
232 (WebCore::SVGSMILElement::hasValidAttributeName const):
233 (WebCore::SVGSMILElement::hasValidAttributeName): Deleted.
234 * svg/animation/SVGSMILElement.h:
235 * svg/properties/SVGAccessor.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h.
236 (WebCore::SVGAccessor::detach const):
237 (WebCore::SVGAccessor::isAnimatedProperty const):
238 (WebCore::SVGAccessor::isAnimatedLength const):
239 (WebCore::SVGAccessor::matches const):
240 (WebCore::SVGAccessor::synchronize const):
241 (WebCore::SVGAccessor::createAnimator const):
242 (WebCore::SVGAccessor::appendAnimatedInstance const):
243 * svg/properties/SVGAccessorPtr.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h.
244 (WebCore::SVGAccessorPtr::SVGAccessorPtr):
245 (WebCore::SVGAccessorPtr::property const):
246 (WebCore::SVGAccessorPtr::singleton):
247 * svg/properties/SVGAnimatedPrimitiveProperty.h: Added.
248 (WebCore::SVGAnimatedPrimitiveProperty::create):
249 (WebCore::SVGAnimatedPrimitiveProperty::setBaseVal):
250 (WebCore::SVGAnimatedPrimitiveProperty::setBaseValInternal):
251 (WebCore::SVGAnimatedPrimitiveProperty::baseVal const):
252 (WebCore::SVGAnimatedPrimitiveProperty::setAnimVal):
253 (WebCore::SVGAnimatedPrimitiveProperty::animVal const):
254 (WebCore::SVGAnimatedPrimitiveProperty::animVal):
255 (WebCore::SVGAnimatedPrimitiveProperty::currentValue const):
256 (WebCore::SVGAnimatedPrimitiveProperty::SVGAnimatedPrimitiveProperty):
257 * svg/properties/SVGAnimatedPropertyAccessor.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
258 * svg/properties/SVGAnimatedPropertyAccessorImpl.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h.
259 * svg/properties/SVGAnimatedPropertyAnimator.h: Added.
260 (WebCore::SVGAnimatedPropertyAnimator::appendAnimatedInstance):
261 (WebCore::SVGAnimatedPropertyAnimator::SVGAnimatedPropertyAnimator):
262 * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h.
263 * svg/properties/SVGAnimatedPropertyImpl.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
264 * svg/properties/SVGAnimatedPropertyPairAccessor.h: Added.
265 (WebCore::SVGAnimatedPropertyPairAccessor::SVGAnimatedPropertyPairAccessor):
266 (WebCore::SVGAnimatedPropertyPairAccessor::singleton):
267 (WebCore::SVGAnimatedPropertyPairAccessor::property1 const):
268 (WebCore::SVGAnimatedPropertyPairAccessor::property2 const):
269 * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h: Added.
270 * svg/properties/SVGAnimatedPropertyPairAnimator.h: Added.
271 (WebCore::SVGAnimatedPropertyPairAnimator::appendAnimatedInstance):
272 (WebCore::SVGAnimatedPropertyPairAnimator::SVGAnimatedPropertyPairAnimator):
273 * svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h: Added.
274 * svg/properties/SVGAnimationAdditiveFunction.h: Added.
275 (WebCore::SVGAnimationAdditiveFunction::SVGAnimationAdditiveFunction):
276 (WebCore::SVGAnimationAdditiveFunction::progress):
277 * svg/properties/SVGAnimationAdditiveValueFunction.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
278 (WebCore::SVGAnimationAdditiveValueFunction::toAtEndOfDuration const):
279 * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.h.
280 (WebCore::SVGAnimationIntegerFunction::progress):
281 * svg/properties/SVGAnimationFunction.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
282 (WebCore::SVGAnimationFunction::isDiscrete const):
283 (WebCore::SVGAnimationFunction::calculateDistance const):
284 (WebCore::SVGAnimationFunction::SVGAnimationFunction):
285 (WebCore::SVGAnimationFunction::addFromAndToValues):
286 * svg/properties/SVGAnimator.cpp: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
287 (WebCore::SVGAnimator::applyAnimatedPropertyChange):
288 * svg/properties/SVGAnimator.h: Added.
289 (WebCore::SVGAnimator::SVGAnimator):
290 (WebCore::SVGAnimator::isDiscrete const):
291 (WebCore::SVGAnimator::setFromAndToValues):
292 (WebCore::SVGAnimator::setFromAndByValues):
293 (WebCore::SVGAnimator::setToAtEndOfDurationValue):
294 (WebCore::SVGAnimator::calculateDistance const):
295 (WebCore::SVGAnimator::createSibling):
296 * svg/properties/SVGAttributeOwnerProxy.cpp:
297 * svg/properties/SVGAttributeOwnerProxy.h:
298 * svg/properties/SVGAttributeRegistry.h:
299 * svg/properties/SVGNewAnimatedProperty.cpp: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
300 (WebCore::SVGNewAnimatedProperty::owner const):
301 (WebCore::SVGNewAnimatedProperty::commitPropertyChange):
302 * svg/properties/SVGNewAnimatedProperty.h: Added.
303 (WebCore::SVGNewAnimatedProperty::isAttached const):
304 (WebCore::SVGNewAnimatedProperty::detach):
305 (WebCore::SVGNewAnimatedProperty::contextElement const):
306 (WebCore::SVGNewAnimatedProperty::baseValAsString const):
307 (WebCore::SVGNewAnimatedProperty::animValAsString const):
308 (WebCore::SVGNewAnimatedProperty::isDirty const):
309 (WebCore::SVGNewAnimatedProperty::setDirty):
310 (WebCore::SVGNewAnimatedProperty::synchronize):
311 (WebCore::SVGNewAnimatedProperty::isAnimating const):
312 (WebCore::SVGNewAnimatedProperty::startAnimation):
313 (WebCore::SVGNewAnimatedProperty::stopAnimation):
314 (WebCore::SVGNewAnimatedProperty::instanceStartAnimation):
315 (WebCore::SVGNewAnimatedProperty::instanceStopAnimation):
316 (WebCore::SVGNewAnimatedProperty::SVGNewAnimatedProperty):
317 * svg/properties/SVGNewProperty.h: Added.
318 * svg/properties/SVGPropertyOwner.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
319 (WebCore::SVGPropertyOwner::owner const):
320 (WebCore::SVGPropertyOwner::attributeContextElement const):
321 (WebCore::SVGPropertyOwner::commitPropertyChange):
322 * svg/properties/SVGPropertyOwnerRegistry.h: Added.
323 (WebCore::SVGPropertyOwnerRegistry::SVGPropertyOwnerRegistry):
324 (WebCore::SVGPropertyOwnerRegistry::registerProperty):
325 (WebCore::SVGPropertyOwnerRegistry::enumerateRecursively):
326 (WebCore::SVGPropertyOwnerRegistry::isKnownAttribute):
327 (WebCore::SVGPropertyOwnerRegistry::enumerateRecursivelyBaseTypes):
328 (WebCore::SVGPropertyOwnerRegistry::findAccessor):
329 * svg/properties/SVGPropertyRegistry.h: Copied from Source/WebCore/svg/properties/SVGAttributeOwnerProxy.cpp.
330