Changeset 250488 in webkit
- Timestamp:
- Sep 28, 2019 10:16:58 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r250464 r250488 1 2019-09-28 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Crash when removing the target element while animating its attributes 4 https://bugs.webkit.org/show_bug.cgi?id=202247 5 6 Reviewed by Darin Adler. 7 8 * svg/animations/animate-and-remove-target-element-expected.txt: Added. 9 * svg/animations/animate-and-remove-target-element.html: Added. 10 1 11 2019-09-27 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r250487 r250488 1 2019-09-28 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Crash when removing the target element while animating its attributes 4 https://bugs.webkit.org/show_bug.cgi?id=202247 5 6 Reviewed by Darin Adler. 7 8 If SMIL is animating a CSS attribute, there is a chance the animation is 9 ended while it is being started or progressed. For that reason, the member 10 SVGAnimateElementBase::m_animator has to be made RefPtr and it has to be 11 be protected in resetAnimatedType() and calculateAnimatedValue(). 12 13 While SMILTimeContainer::updateAnimations() is calling progress() for the 14 scheduled animation elements, SMILTimeContainer::unschedule() might get 15 called if processing an animation causes events to be dispatched. For that 16 reason we need to copy the scheduled animations Vector before processing 17 them so we avoid changing the Vector while looping through its items. 18 19 Remove the guard SMILTimeContainer::m_preventScheduledAnimationsChanges 20 which was added in r129670 for debugging purposes. In some situations, 21 the scheduled animations map could be modified out from under some of the 22 functions of SMILTimeContainer. 23 24 Test: svg/animations/animate-and-remove-target-element.html 25 26 * svg/SVGAnimateElementBase.cpp: 27 (WebCore::SVGAnimateElementBase::resetAnimatedType): 28 (WebCore::SVGAnimateElementBase::calculateAnimatedValue): 29 * svg/SVGAnimateElementBase.h: 30 * svg/SVGElement.cpp: 31 (WebCore::SVGElement::createAnimator): 32 * svg/SVGElement.h: 33 * svg/animation/SMILTimeContainer.cpp: 34 (WebCore::SMILTimeContainer::schedule): 35 (WebCore::SMILTimeContainer::unschedule): 36 (WebCore::SMILTimeContainer::setElapsed): 37 (WebCore::SMILTimeContainer::sortByPriority): 38 (WebCore::SMILTimeContainer::processAnimations): 39 (WebCore::SMILTimeContainer::processScheduledAnimations): 40 (WebCore::SMILTimeContainer::updateAnimations): 41 (WebCore::SMILTimeContainer::~SMILTimeContainer): Deleted. 42 * svg/animation/SMILTimeContainer.h: 43 * svg/animation/SVGSMILElement.cpp: 44 (WebCore::SVGSMILElement::calculateNextProgressTime const): 45 * svg/properties/SVGAnimatedPropertyAccessorImpl.h: 46 * svg/properties/SVGAnimatedPropertyAnimatorImpl.h: 47 * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h: 48 * svg/properties/SVGAnimatedPropertyPairAnimator.h: 49 * svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h: 50 * svg/properties/SVGAttributeAnimator.h: 51 * svg/properties/SVGMemberAccessor.h: 52 (WebCore::SVGMemberAccessor::createAnimator const): 53 * svg/properties/SVGPrimitivePropertyAnimator.h: 54 (WebCore::SVGPrimitivePropertyAnimator::create): 55 * svg/properties/SVGPropertyAnimatorFactory.h: 56 (WebCore::SVGPropertyAnimatorFactory::createAnimator): 57 * svg/properties/SVGPropertyOwnerRegistry.h: 58 * svg/properties/SVGPropertyRegistry.h: 59 * svg/properties/SVGValuePropertyAnimatorImpl.h: 60 * svg/properties/SVGValuePropertyListAnimatorImpl.h: 61 1 62 2019-09-28 Zalan Bujtas <zalan@apple.com> 2 63 -
trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp
r250175 r250488 152 152 return; 153 153 154 if (auto * animator = this->animator())155 animator->start(targetElement());154 if (auto protectedAnimator = makeRefPtr(this->animator())) 155 protectedAnimator->start(targetElement()); 156 156 } 157 157 … … 168 168 progress = progress < 0.5 ? 0 : 1; 169 169 170 if (auto * animator = this->animator())171 animator->animate(targetElement(), progress, repeatCount);170 if (auto protectedAnimator = makeRefPtr(this->animator())) 171 protectedAnimator->animate(targetElement(), progress, repeatCount); 172 172 } 173 173 -
trunk/Source/WebCore/svg/SVGAnimateElementBase.h
r250175 r250488 62 62 bool hasInvalidCSSAttributeType() const; 63 63 64 mutable std::unique_ptr<SVGAttributeAnimator> m_animator;64 mutable RefPtr<SVGAttributeAnimator> m_animator; 65 65 mutable Optional<bool> m_hasInvalidCSSAttributeType; 66 66 }; -
trunk/Source/WebCore/svg/SVGElement.cpp
r248983 r250488 605 605 } 606 606 607 std::unique_ptr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)607 RefPtr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 608 608 { 609 609 // Property animator, e.g. "fill" or "fill-opacity". -
trunk/Source/WebCore/svg/SVGElement.h
r248983 r250488 142 142 const SVGElement* attributeContextElement() const override { return this; } 143 143 SVGPropertyAnimatorFactory& propertyAnimatorFactory() { return *m_propertyAnimatorFactory; } 144 std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive);144 RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive); 145 145 void animatorWillBeDeleted(const QualifiedName&); 146 146 -
trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp
r248846 r250488 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 } 46 46 47 SMILTimeContainer::~SMILTimeContainer()48 {49 #ifndef NDEBUG50 ASSERT(!m_preventScheduledAnimationsChanges);51 #endif52 }53 54 47 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target, const QualifiedName& attributeName) 55 48 { … … 57 50 ASSERT(target); 58 51 ASSERT(animation->hasValidAttributeName()); 59 60 #ifndef NDEBUG61 ASSERT(!m_preventScheduledAnimationsChanges);62 #endif63 52 64 53 ElementAttributePair key(target, attributeName); … … 78 67 ASSERT(animation->timeContainer() == this); 79 68 80 #ifndef NDEBUG81 ASSERT(!m_preventScheduledAnimationsChanges);82 #endif83 84 69 ElementAttributePair key(target, attributeName); 85 70 AnimationsVector* scheduled = m_scheduledAnimations.get(key); … … 185 170 m_resumeTime = m_beginTime; 186 171 187 #ifndef NDEBUG 188 m_preventScheduledAnimationsChanges = true; 189 #endif 190 for (auto& animation : m_scheduledAnimations.values()) { 191 for (auto& element : *animation) 192 element->reset(); 193 } 194 #ifndef NDEBUG 195 m_preventScheduledAnimationsChanges = false; 196 #endif 172 processScheduledAnimations([](auto* animation) { 173 animation->reset(); 174 }); 197 175 198 176 updateAnimations(time, true); … … 245 223 }; 246 224 247 void SMILTimeContainer::sortByPriority( Vector<SVGSMILElement*>& smilElements, SMILTime elapsed)225 void SMILTimeContainer::sortByPriority(AnimationsVector& animations, SMILTime elapsed) 248 226 { 249 227 if (m_documentOrderIndexesDirty) 250 228 updateDocumentOrderIndexes(); 251 std::sort(smilElements.begin(), smilElements.end(), PriorityCompare(elapsed)); 229 std::sort(animations.begin(), animations.end(), PriorityCompare(elapsed)); 230 } 231 232 void SMILTimeContainer::processAnimations(const AnimationsVector& animations, Function<void(SVGSMILElement*)>&& callback) 233 { 234 // 'animations' may change if 'callback' causes an animation to end which will end up calling 235 // unschedule(). Copy 'animations' so none of the items gets deleted out from underneath us. 236 auto animationsCopy = animations; 237 for (auto* animation : animations) 238 callback(animation); 239 } 240 241 void SMILTimeContainer::processScheduledAnimations(Function<void(SVGSMILElement*)>&& callback) 242 { 243 for (auto& it : m_scheduledAnimations) 244 processAnimations(*it.value, WTFMove(callback)); 252 245 } 253 246 254 247 void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) 255 248 { 256 SMILTime earliestFireTime = SMILTime::unresolved();257 258 249 // Don't mutate the DOM while updating the animations. 259 250 EventQueueScope scope; 260 261 #ifndef NDEBUG 262 // This boolean will catch any attempts to schedule/unschedule scheduledAnimations during this critical section. 263 // Similarly, any elements removed will unschedule themselves, so this will catch modification of animationsToApply. 264 m_preventScheduledAnimationsChanges = true; 265 #endif 251 252 processScheduledAnimations([](auto* animation) { 253 if (!animation->hasConditionsConnected()) 254 animation->connectConditions(); 255 }); 266 256 267 257 AnimationsVector animationsToApply; 258 SMILTime earliestFireTime = SMILTime::unresolved(); 259 268 260 for (auto& it : m_scheduledAnimations) { 269 AnimationsVector* scheduled = it.value.get();270 for (auto* animation : *scheduled) {271 if (!animation->hasConditionsConnected())272 animation->connectConditions();273 }274 }275 276 for (auto& it : m_scheduledAnimations) {277 AnimationsVector* scheduled = it.value.get();278 279 261 // Sort according to priority. Elements with later begin time have higher priority. 280 // In case of a tie, document order decides. 262 // In case of a tie, document order decides. 281 263 // FIXME: This should also consider timing relationships between the elements. Dependents 282 264 // have higher priority. 283 sortByPriority(* scheduled, elapsed);284 285 RefPtr<SVGSMILElement> resultElement;286 for (auto& animation : *scheduled) {265 sortByPriority(*it.value, elapsed); 266 267 RefPtr<SVGSMILElement> firstAnimation; 268 processAnimations(*it.value, [&](auto* animation) { 287 269 ASSERT(animation->timeContainer() == this); 288 270 ASSERT(animation->targetElement()); … … 290 272 291 273 // Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair. 292 if (! resultElement) {274 if (!firstAnimation) { 293 275 if (!animation->hasValidAttributeType()) 294 continue;295 resultElement= animation;276 return; 277 firstAnimation = animation; 296 278 } 297 279 298 280 // This will calculate the contribution from the animation and add it to the resultsElement. 299 if (!animation->progress(elapsed, resultElement.get(), seekToTime) && resultElement== animation)300 resultElement= nullptr;281 if (!animation->progress(elapsed, firstAnimation.get(), seekToTime) && firstAnimation == animation) 282 firstAnimation = nullptr; 301 283 302 284 SMILTime nextFireTime = animation->nextProgressTime(); 303 285 if (nextFireTime.isFinite()) 304 286 earliestFireTime = std::min(nextFireTime, earliestFireTime); 305 } 306 307 if (resultElement) 308 animationsToApply.append(resultElement.get()); 309 } 310 311 if (animationsToApply.isEmpty()) { 312 #ifndef NDEBUG 313 m_preventScheduledAnimationsChanges = false; 314 #endif 315 startTimer(elapsed, earliestFireTime, animationFrameDelay()); 316 return; 287 }); 288 289 if (firstAnimation) 290 animationsToApply.append(firstAnimation.get()); 317 291 } 318 292 … … 321 295 animation->applyResultsToTarget(); 322 296 323 #ifndef NDEBUG324 m_preventScheduledAnimationsChanges = false;325 #endif326 327 297 startTimer(elapsed, earliestFireTime, animationFrameDelay()); 328 298 } -
trunk/Source/WebCore/svg/animation/SMILTimeContainer.h
r229174 r250488 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 43 43 public: 44 44 static Ref<SMILTimeContainer> create(SVGSVGElement& owner) { return adoptRef(*new SMILTimeContainer(owner)); } 45 ~SMILTimeContainer();46 45 47 46 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&); … … 70 69 void startTimer(SMILTime elapsed, SMILTime fireTime, SMILTime minimumDelay = 0); 71 70 void updateAnimations(SMILTime elapsed, bool seekToTime = false); 72 71 72 typedef std::pair<SVGElement*, QualifiedName> ElementAttributePair; 73 typedef Vector<SVGSMILElement*> AnimationsVector; 74 typedef HashMap<ElementAttributePair, std::unique_ptr<AnimationsVector>> GroupedAnimationsMap; 75 76 void processAnimations(const AnimationsVector&, Function<void(SVGSMILElement*)>&&); 77 void processScheduledAnimations(Function<void(SVGSMILElement*)>&&); 73 78 void updateDocumentOrderIndexes(); 74 void sortByPriority( Vector<SVGSMILElement*>& smilElements, SMILTime elapsed);79 void sortByPriority(AnimationsVector& smilElements, SMILTime elapsed); 75 80 76 81 MonotonicTime m_beginTime; … … 81 86 82 87 bool m_documentOrderIndexesDirty { false }; 83 84 88 Timer m_timer; 85 86 typedef std::pair<SVGElement*, QualifiedName> ElementAttributePair;87 typedef Vector<SVGSMILElement*> AnimationsVector;88 typedef HashMap<ElementAttributePair, std::unique_ptr<AnimationsVector>> GroupedAnimationsMap;89 89 GroupedAnimationsMap m_scheduledAnimations; 90 91 90 SVGSVGElement& m_ownerSVGElement; 92 93 #ifndef NDEBUG94 bool m_preventScheduledAnimationsChanges { false };95 #endif96 91 }; 97 92 -
trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp
r249216 r250488 1041 1041 SMILTime SVGSMILElement::calculateNextProgressTime(SMILTime elapsed) const 1042 1042 { 1043 ASSERT(m_timeContainer); 1044 if (m_activeState == Active) { 1043 if (m_timeContainer && m_activeState == Active) { 1045 1044 // If duration is indefinite the value does not actually change over time. Same is true for <set>. 1046 1045 SMILTime simpleDuration = this->simpleDuration(); -
trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h
r249822 r250488 54 54 55 55 private: 56 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final56 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 57 57 { 58 58 return SVGAnimatedBooleanAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 76 76 77 77 private: 78 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final78 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 79 79 { 80 80 return SVGAnimatedEnumerationAnimator<EnumType>::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 98 98 99 99 private: 100 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final100 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 101 101 { 102 102 return SVGAnimatedIntegerAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 122 122 bool isAnimatedLength() const override { return true; } 123 123 124 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final124 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 125 125 { 126 126 SVGLengthMode lengthMode = property(owner)->baseVal()->value().lengthMode(); … … 145 145 146 146 private: 147 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final147 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 148 148 { 149 149 return SVGAnimatedLengthListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Width); … … 167 167 168 168 private: 169 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final169 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 170 170 { 171 171 return SVGAnimatedNumberAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 189 189 190 190 private: 191 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final191 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 192 192 { 193 193 return SVGAnimatedNumberListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 211 211 212 212 private: 213 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final213 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 214 214 { 215 215 return SVGAnimatedPathSegListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 233 233 234 234 private: 235 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final235 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 236 236 { 237 237 return SVGAnimatedPointListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 265 265 266 266 private: 267 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final267 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 268 268 { 269 269 return SVGAnimatedPreserveAspectRatioAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 287 287 288 288 private: 289 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final289 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 290 290 { 291 291 return SVGAnimatedRectAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 309 309 310 310 private: 311 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final311 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 312 312 { 313 313 return SVGAnimatedStringAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 331 331 332 332 private: 333 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final333 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 334 334 { 335 335 return SVGAnimatedTransformListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive); -
trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h
r248846 r250488 51 51 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedAngle>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 52 52 { 53 return makeUnique<SVGAnimatedAngleAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);53 return adoptRef(*new SVGAnimatedAngleAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 54 54 } 55 55 … … 69 69 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedBoolean>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 70 70 { 71 return makeUnique<SVGAnimatedBooleanAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);71 return adoptRef(*new SVGAnimatedBooleanAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 72 72 } 73 73 … … 90 90 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedEnumeration>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 91 91 { 92 return makeUnique<SVGAnimatedEnumerationAnimator<EnumType>>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);92 return adoptRef(*new SVGAnimatedEnumerationAnimator<EnumType>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 93 93 } 94 94 … … 112 112 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedInteger>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 113 113 { 114 return makeUnique<SVGAnimatedIntegerAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);114 return adoptRef(*new SVGAnimatedIntegerAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 115 115 } 116 116 … … 133 133 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLength>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode) 134 134 { 135 return makeUnique<SVGAnimatedLengthAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);135 return adoptRef(*new SVGAnimatedLengthAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode)); 136 136 } 137 137 … … 154 154 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLengthList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode) 155 155 { 156 return makeUnique<SVGAnimatedLengthListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);156 return adoptRef(*new SVGAnimatedLengthListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode)); 157 157 } 158 158 … … 173 173 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumber>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 174 174 { 175 return makeUnique<SVGAnimatedNumberAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);175 return adoptRef(*new SVGAnimatedNumberAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 176 176 } 177 177 … … 190 190 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumberList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 191 191 { 192 return makeUnique<SVGAnimatedNumberListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);192 return adoptRef(*new SVGAnimatedNumberListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 193 193 } 194 194 … … 207 207 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPathSegList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 208 208 { 209 return makeUnique<SVGAnimatedPathSegListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);209 return adoptRef(*new SVGAnimatedPathSegListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 210 210 } 211 211 … … 225 225 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPointList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 226 226 { 227 return makeUnique<SVGAnimatedPointListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);227 return adoptRef(*new SVGAnimatedPointListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 228 228 } 229 229 … … 244 244 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedOrientType>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 245 245 { 246 return makeUnique<SVGAnimatedOrientTypeAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);246 return adoptRef(*new SVGAnimatedOrientTypeAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 247 247 } 248 248 … … 263 263 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPreserveAspectRatio>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 264 264 { 265 return makeUnique<SVGAnimatedPreserveAspectRatioAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);265 return adoptRef(*new SVGAnimatedPreserveAspectRatioAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 266 266 } 267 267 … … 282 282 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedRect>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 283 283 { 284 return makeUnique<SVGAnimatedRectAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);284 return adoptRef(*new SVGAnimatedRectAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 285 285 } 286 286 … … 299 299 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedString>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 300 300 { 301 return makeUnique<SVGAnimatedStringAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);301 return adoptRef(*new SVGAnimatedStringAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 302 302 } 303 303 … … 339 339 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedTransformList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 340 340 { 341 return makeUnique<SVGAnimatedTransformListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);341 return adoptRef(*new SVGAnimatedTransformListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive)); 342 342 } 343 343 -
trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessorImpl.h
r243478 r250488 61 61 } 62 62 63 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final63 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 64 64 { 65 65 return SVGAnimatedAngleOrientAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 96 96 } 97 97 98 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final98 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 99 99 { 100 100 return SVGAnimatedIntegerPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive); … … 131 131 } 132 132 133 std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final133 RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final 134 134 { 135 135 return SVGAnimatedNumberPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive); -
trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimator.h
r243830 r250488 75 75 } 76 76 77 std::unique_ptr<AnimatedPropertyAnimator1> m_animatedPropertyAnimator1;78 std::unique_ptr<AnimatedPropertyAnimator2> m_animatedPropertyAnimator2;77 Ref<AnimatedPropertyAnimator1> m_animatedPropertyAnimator1; 78 Ref<AnimatedPropertyAnimator2> m_animatedPropertyAnimator2; 79 79 }; 80 80 -
trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h
r248846 r250488 41 41 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedAngle>& animated1, Ref<SVGAnimatedOrientType>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 42 42 { 43 return makeUnique<SVGAnimatedAngleOrientAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);43 return adoptRef(*new SVGAnimatedAngleOrientAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive)); 44 44 } 45 45 … … 114 114 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedInteger>& animated1, Ref<SVGAnimatedInteger>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 115 115 { 116 return makeUnique<SVGAnimatedIntegerPairAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);116 return adoptRef(*new SVGAnimatedIntegerPairAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive)); 117 117 } 118 118 … … 157 157 static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumber>& animated1, Ref<SVGAnimatedNumber>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 158 158 { 159 return makeUnique<SVGAnimatedNumberPairAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);159 return adoptRef(*new SVGAnimatedNumberPairAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive)); 160 160 } 161 161 -
trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h
r248762 r250488 52 52 }; 53 53 54 class SVGAttributeAnimator {54 class SVGAttributeAnimator : public RefCounted<SVGAttributeAnimator> { 55 55 WTF_MAKE_FAST_ALLOCATED; 56 56 public: -
trunk/Source/WebCore/svg/properties/SVGMemberAccessor.h
r243130 r250488 48 48 virtual Optional<String> synchronize(const OwnerType&) const { return WTF::nullopt; } 49 49 50 virtual std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType&, const QualifiedName&, AnimationMode, CalcMode, bool, bool) const { return nullptr; }50 virtual RefPtr<SVGAttributeAnimator> createAnimator(OwnerType&, const QualifiedName&, AnimationMode, CalcMode, bool, bool) const { return nullptr; } 51 51 virtual void appendAnimatedInstance(OwnerType&, SVGAttributeAnimator&) const { } 52 52 -
trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h
r248846 r250488 45 45 static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 46 46 { 47 return makeUnique<SVGPrimitivePropertyAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);47 return adoptRef(*new SVGPrimitivePropertyAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive)); 48 48 } 49 49 -
trunk/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h
r248762 r250488 44 44 } 45 45 46 std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)46 RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 47 47 { 48 48 auto iterator = attributeAnimatorCreator().find(attributeName.impl()); … … 76 76 std::pair< 77 77 std::function<Ref<SVGProperty>()>, 78 std::function< std::unique_ptr<SVGAttributeAnimator>(const QualifiedName&, Ref<SVGProperty>&&, AnimationMode, CalcMode, bool, bool)>78 std::function<Ref<SVGAttributeAnimator>(const QualifiedName&, Ref<SVGProperty>&&, AnimationMode, CalcMode, bool, bool)> 79 79 > 80 80 >; -
trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h
r243730 r250488 267 267 } 268 268 269 std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const override270 { 271 std::unique_ptr<SVGAttributeAnimator> animator;269 RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const override 270 { 271 RefPtr<SVGAttributeAnimator> animator; 272 272 enumerateRecursively([&](const auto& entry) -> bool { 273 273 if (!entry.key.matches(attributeName)) -
trunk/Source/WebCore/svg/properties/SVGPropertyRegistry.h
r243478 r250488 45 45 virtual bool isAnimatedPropertyAttribute(const QualifiedName&) const = 0; 46 46 virtual bool isAnimatedStylePropertyAttribute(const QualifiedName&) const = 0; 47 virtual std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive) const = 0;47 virtual RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive) const = 0; 48 48 virtual void appendAnimatedInstance(const QualifiedName& attributeName, SVGAttributeAnimator&) const = 0; 49 49 }; -
trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h
r249822 r250488 40 40 static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 41 41 { 42 return makeUnique<SVGLengthAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other);42 return adoptRef(*new SVGLengthAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other)); 43 43 } 44 44 -
trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h
r249822 r250488 40 40 static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) 41 41 { 42 return makeUnique<SVGLengthListAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other);42 return adoptRef(*new SVGLengthListAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other)); 43 43 } 44 44
Note: See TracChangeset
for help on using the changeset viewer.