Crash when removing the target element while animating its attributes
authorsaid@apple.com <said@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Sep 2019 05:16:58 +0000 (05:16 +0000)
committersaid@apple.com <said@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Sep 2019 05:16:58 +0000 (05:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202247

Reviewed by Darin Adler.

Source/WebCore:

If SMIL is animating a CSS attribute, there is a chance the animation is
ended while it is being started or progressed. For that reason, the member
SVGAnimateElementBase::m_animator has to be made RefPtr and it has to be
be protected in resetAnimatedType() and calculateAnimatedValue().

While SMILTimeContainer::updateAnimations() is calling progress() for the
scheduled animation elements, SMILTimeContainer::unschedule() might get
called if processing an animation causes events to be dispatched. For that
reason we need to copy the scheduled animations Vector before processing
them so we avoid changing the Vector while looping through its items.

Remove the guard SMILTimeContainer::m_preventScheduledAnimationsChanges
which was added in r129670 for debugging purposes. In some situations,
the scheduled animations map could be modified out from under some of the
functions of SMILTimeContainer.

Test: svg/animations/animate-and-remove-target-element.html

* svg/SVGAnimateElementBase.cpp:
(WebCore::SVGAnimateElementBase::resetAnimatedType):
(WebCore::SVGAnimateElementBase::calculateAnimatedValue):
* svg/SVGAnimateElementBase.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::createAnimator):
* svg/SVGElement.h:
* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::schedule):
(WebCore::SMILTimeContainer::unschedule):
(WebCore::SMILTimeContainer::setElapsed):
(WebCore::SMILTimeContainer::sortByPriority):
(WebCore::SMILTimeContainer::processAnimations):
(WebCore::SMILTimeContainer::processScheduledAnimations):
(WebCore::SMILTimeContainer::updateAnimations):
(WebCore::SMILTimeContainer::~SMILTimeContainer): Deleted.
* svg/animation/SMILTimeContainer.h:
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::calculateNextProgressTime const):
* svg/properties/SVGAnimatedPropertyAccessorImpl.h:
* svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
* svg/properties/SVGAnimatedPropertyPairAccessorImpl.h:
* svg/properties/SVGAnimatedPropertyPairAnimator.h:
* svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h:
* svg/properties/SVGAttributeAnimator.h:
* svg/properties/SVGMemberAccessor.h:
(WebCore::SVGMemberAccessor::createAnimator const):
* svg/properties/SVGPrimitivePropertyAnimator.h:
(WebCore::SVGPrimitivePropertyAnimator::create):
* svg/properties/SVGPropertyAnimatorFactory.h:
(WebCore::SVGPropertyAnimatorFactory::createAnimator):
* svg/properties/SVGPropertyOwnerRegistry.h:
* svg/properties/SVGPropertyRegistry.h:
* svg/properties/SVGValuePropertyAnimatorImpl.h:
* svg/properties/SVGValuePropertyListAnimatorImpl.h:

LayoutTests:

* svg/animations/animate-and-remove-target-element-expected.txt: Added.
* svg/animations/animate-and-remove-target-element.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250488 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/animations/animate-and-remove-target-element-expected.txt [new file with mode: 0644]
LayoutTests/svg/animations/animate-and-remove-target-element.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/svg/SVGAnimateElementBase.cpp
Source/WebCore/svg/SVGAnimateElementBase.h
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h
Source/WebCore/svg/animation/SMILTimeContainer.cpp
Source/WebCore/svg/animation/SMILTimeContainer.h
Source/WebCore/svg/animation/SVGSMILElement.cpp
Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h
Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h
Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessorImpl.h
Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimator.h
Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h
Source/WebCore/svg/properties/SVGAttributeAnimator.h
Source/WebCore/svg/properties/SVGMemberAccessor.h
Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h
Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h
Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h
Source/WebCore/svg/properties/SVGPropertyRegistry.h
Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h
Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h

index d9ce9ec..9947b57 100644 (file)
@@ -1,3 +1,13 @@
+2019-09-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Crash when removing the target element while animating its attributes
+        https://bugs.webkit.org/show_bug.cgi?id=202247
+
+        Reviewed by Darin Adler.
+
+        * svg/animations/animate-and-remove-target-element-expected.txt: Added.
+        * svg/animations/animate-and-remove-target-element.html: Added.
+
 2019-09-27  Chris Dumez  <cdumez@apple.com>
 
         Pages using WebGLRenderingContext fail to enter the back/forward cache
diff --git a/LayoutTests/svg/animations/animate-and-remove-target-element-expected.txt b/LayoutTests/svg/animations/animate-and-remove-target-element-expected.txt
new file mode 100644 (file)
index 0000000..e97e990
--- /dev/null
@@ -0,0 +1,4 @@
+Passes if it does not crash.
+
+
diff --git a/LayoutTests/svg/animations/animate-and-remove-target-element.html b/LayoutTests/svg/animations/animate-and-remove-target-element.html
new file mode 100644 (file)
index 0000000..e130fd0
--- /dev/null
@@ -0,0 +1,33 @@
+<body>
+    <p>Passes if it does not crash.</p>
+    <form>
+        <select id="select" onfocus="onFocus()" multiple></select>
+        <keygen/>
+    </form>
+    <svg id="svg">
+        <animate attributeName="opacity" onbegin="onBegin()"/>
+    </svg>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        window.addEventListener('load', (event) => {
+            select.autofocus = true;
+        });
+
+        function onFocus(){
+            svg.remove();
+        }
+
+        function onBegin(){
+            select.removeAttribute("multiple");
+            svg.setCurrentTime(9);
+            setTimeout(() => {
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }
+    </script>
+</body>
index f5c7743..ee4fd11 100644 (file)
@@ -1,3 +1,64 @@
+2019-09-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        Crash when removing the target element while animating its attributes
+        https://bugs.webkit.org/show_bug.cgi?id=202247
+
+        Reviewed by Darin Adler.
+
+        If SMIL is animating a CSS attribute, there is a chance the animation is
+        ended while it is being started or progressed. For that reason, the member
+        SVGAnimateElementBase::m_animator has to be made RefPtr and it has to be
+        be protected in resetAnimatedType() and calculateAnimatedValue().
+
+        While SMILTimeContainer::updateAnimations() is calling progress() for the
+        scheduled animation elements, SMILTimeContainer::unschedule() might get
+        called if processing an animation causes events to be dispatched. For that
+        reason we need to copy the scheduled animations Vector before processing
+        them so we avoid changing the Vector while looping through its items.
+
+        Remove the guard SMILTimeContainer::m_preventScheduledAnimationsChanges
+        which was added in r129670 for debugging purposes. In some situations, 
+        the scheduled animations map could be modified out from under some of the
+        functions of SMILTimeContainer.
+
+        Test: svg/animations/animate-and-remove-target-element.html
+
+        * svg/SVGAnimateElementBase.cpp:
+        (WebCore::SVGAnimateElementBase::resetAnimatedType):
+        (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
+        * svg/SVGAnimateElementBase.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::createAnimator):
+        * svg/SVGElement.h:
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::schedule):
+        (WebCore::SMILTimeContainer::unschedule):
+        (WebCore::SMILTimeContainer::setElapsed):
+        (WebCore::SMILTimeContainer::sortByPriority):
+        (WebCore::SMILTimeContainer::processAnimations):
+        (WebCore::SMILTimeContainer::processScheduledAnimations):
+        (WebCore::SMILTimeContainer::updateAnimations):
+        (WebCore::SMILTimeContainer::~SMILTimeContainer): Deleted.
+        * svg/animation/SMILTimeContainer.h:
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::calculateNextProgressTime const):
+        * svg/properties/SVGAnimatedPropertyAccessorImpl.h:
+        * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
+        * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h:
+        * svg/properties/SVGAnimatedPropertyPairAnimator.h:
+        * svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h:
+        * svg/properties/SVGAttributeAnimator.h:
+        * svg/properties/SVGMemberAccessor.h:
+        (WebCore::SVGMemberAccessor::createAnimator const):
+        * svg/properties/SVGPrimitivePropertyAnimator.h:
+        (WebCore::SVGPrimitivePropertyAnimator::create):
+        * svg/properties/SVGPropertyAnimatorFactory.h:
+        (WebCore::SVGPropertyAnimatorFactory::createAnimator):
+        * svg/properties/SVGPropertyOwnerRegistry.h:
+        * svg/properties/SVGPropertyRegistry.h:
+        * svg/properties/SVGValuePropertyAnimatorImpl.h:
+        * svg/properties/SVGValuePropertyListAnimatorImpl.h:
+
 2019-09-28  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][IFC] Move horizontal alignment to Line
index 6130cd9..f1f749e 100644 (file)
@@ -151,8 +151,8 @@ void SVGAnimateElementBase::resetAnimatedType()
     if (!targetElement())
         return;
 
-    if (auto* animator = this->animator())
-        animator->start(targetElement());
+    if (auto protectedAnimator = makeRefPtr(this->animator()))
+        protectedAnimator->start(targetElement());
 }
 
 void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount, SVGSMILElement*)
@@ -167,8 +167,8 @@ void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repe
     if (calcMode() == CalcMode::Discrete)
         progress = progress < 0.5 ? 0 : 1;
 
-    if (auto* animator = this->animator())
-        animator->animate(targetElement(), progress, repeatCount);
+    if (auto protectedAnimator = makeRefPtr(this->animator()))
+        protectedAnimator->animate(targetElement(), progress, repeatCount);
 }
 
 void SVGAnimateElementBase::applyResultsToTarget()
index dac6c42..398cd19 100644 (file)
@@ -61,7 +61,7 @@ private:
 
     bool hasInvalidCSSAttributeType() const;
 
-    mutable std::unique_ptr<SVGAttributeAnimator> m_animator;
+    mutable RefPtr<SVGAttributeAnimator> m_animator;
     mutable Optional<bool> m_hasInvalidCSSAttributeType;
 };
 
index 38c8f8d..16c3afc 100644 (file)
@@ -604,7 +604,7 @@ bool SVGElement::isAnimatedStyleAttribute(const QualifiedName& attributeName) co
     return SVGPropertyAnimatorFactory::isKnownAttribute(attributeName) || propertyRegistry().isAnimatedStylePropertyAttribute(attributeName);
 }
 
-std::unique_ptr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+RefPtr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 {
     // Property animator, e.g. "fill" or "fill-opacity".
     if (auto animator = propertyAnimatorFactory().createAnimator(attributeName, animationMode, calcMode, isAccumulated, isAdditive))
index f36db5d..8cc6aac 100644 (file)
@@ -141,7 +141,7 @@ public:
 
     const SVGElement* attributeContextElement() const override { return this; }
     SVGPropertyAnimatorFactory& propertyAnimatorFactory() { return *m_propertyAnimatorFactory; }
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive);
+    RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive);
     void animatorWillBeDeleted(const QualifiedName&);
 
     // These are needed for the RenderTree, animation and DOM.
index 3eb57ad..4c3da65 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -44,23 +44,12 @@ SMILTimeContainer::SMILTimeContainer(SVGSVGElement& owner)
 {
 }
 
-SMILTimeContainer::~SMILTimeContainer()
-{
-#ifndef NDEBUG
-    ASSERT(!m_preventScheduledAnimationsChanges);
-#endif
-}
-
 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target, const QualifiedName& attributeName)
 {
     ASSERT(animation->timeContainer() == this);
     ASSERT(target);
     ASSERT(animation->hasValidAttributeName());
 
-#ifndef NDEBUG
-    ASSERT(!m_preventScheduledAnimationsChanges);
-#endif
-
     ElementAttributePair key(target, attributeName);
     std::unique_ptr<AnimationsVector>& scheduled = m_scheduledAnimations.add(key, nullptr).iterator->value;
     if (!scheduled)
@@ -77,10 +66,6 @@ void SMILTimeContainer::unschedule(SVGSMILElement* animation, SVGElement* target
 {
     ASSERT(animation->timeContainer() == this);
 
-#ifndef NDEBUG
-    ASSERT(!m_preventScheduledAnimationsChanges);
-#endif
-
     ElementAttributePair key(target, attributeName);
     AnimationsVector* scheduled = m_scheduledAnimations.get(key);
     ASSERT(scheduled);
@@ -184,16 +169,9 @@ void SMILTimeContainer::setElapsed(SMILTime time)
     } else
         m_resumeTime = m_beginTime;
 
-#ifndef NDEBUG
-    m_preventScheduledAnimationsChanges = true;
-#endif
-    for (auto& animation : m_scheduledAnimations.values()) {
-        for (auto& element : *animation)
-            element->reset();
-    }
-#ifndef NDEBUG
-    m_preventScheduledAnimationsChanges = false;
-#endif
+    processScheduledAnimations([](auto* animation) {
+        animation->reset();
+    });
 
     updateAnimations(time, true);
 }
@@ -244,86 +222,78 @@ struct PriorityCompare {
     SMILTime m_elapsed;
 };
 
-void SMILTimeContainer::sortByPriority(Vector<SVGSMILElement*>& smilElements, SMILTime elapsed)
+void SMILTimeContainer::sortByPriority(AnimationsVector& animations, SMILTime elapsed)
 {
     if (m_documentOrderIndexesDirty)
         updateDocumentOrderIndexes();
-    std::sort(smilElements.begin(), smilElements.end(), PriorityCompare(elapsed));
+    std::sort(animations.begin(), animations.end(), PriorityCompare(elapsed));
 }
 
-void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
+void SMILTimeContainer::processAnimations(const AnimationsVector& animations, Function<void(SVGSMILElement*)>&& callback)
 {
-    SMILTime earliestFireTime = SMILTime::unresolved();
+    // 'animations' may change if 'callback' causes an animation to end which will end up calling
+    // unschedule(). Copy 'animations' so none of the items gets deleted out from underneath us.
+    auto animationsCopy = animations;
+    for (auto* animation : animations)
+        callback(animation);
+}
+
+void SMILTimeContainer::processScheduledAnimations(Function<void(SVGSMILElement*)>&& callback)
+{
+    for (auto& it : m_scheduledAnimations)
+        processAnimations(*it.value, WTFMove(callback));
+}
 
+void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
+{
     // Don't mutate the DOM while updating the animations.
     EventQueueScope scope;
-    
-#ifndef NDEBUG
-    // This boolean will catch any attempts to schedule/unschedule scheduledAnimations during this critical section.
-    // Similarly, any elements removed will unschedule themselves, so this will catch modification of animationsToApply.
-    m_preventScheduledAnimationsChanges = true;
-#endif
+
+    processScheduledAnimations([](auto* animation) {
+        if (!animation->hasConditionsConnected())
+            animation->connectConditions();
+    });
 
     AnimationsVector animationsToApply;
-    for (auto& it : m_scheduledAnimations) {
-        AnimationsVector* scheduled = it.value.get();
-        for (auto* animation : *scheduled) {
-            if (!animation->hasConditionsConnected())
-                animation->connectConditions();
-        }
-    }
-    
-    for (auto& it : m_scheduledAnimations) {
-        AnimationsVector* scheduled = it.value.get();
+    SMILTime earliestFireTime = SMILTime::unresolved();
 
+    for (auto& it : m_scheduledAnimations) {
         // Sort according to priority. Elements with later begin time have higher priority.
-        // In case of a tie, document order decides. 
+        // In case of a tie, document order decides.
         // FIXME: This should also consider timing relationships between the elements. Dependents
         // have higher priority.
-        sortByPriority(*scheduled, elapsed);
+        sortByPriority(*it.value, elapsed);
 
-        RefPtr<SVGSMILElement> resultElement;
-        for (auto& animation : *scheduled) {
+        RefPtr<SVGSMILElement> firstAnimation;
+        processAnimations(*it.value, [&](auto* animation) {
             ASSERT(animation->timeContainer() == this);
             ASSERT(animation->targetElement());
             ASSERT(animation->hasValidAttributeName());
 
             // Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair.
-            if (!resultElement) {
+            if (!firstAnimation) {
                 if (!animation->hasValidAttributeType())
-                    continue;
-                resultElement = animation;
+                    return;
+                firstAnimation = animation;
             }
 
             // This will calculate the contribution from the animation and add it to the resultsElement.
-            if (!animation->progress(elapsed, resultElement.get(), seekToTime) && resultElement == animation)
-                resultElement = nullptr;
+            if (!animation->progress(elapsed, firstAnimation.get(), seekToTime) && firstAnimation == animation)
+                firstAnimation = nullptr;
 
             SMILTime nextFireTime = animation->nextProgressTime();
             if (nextFireTime.isFinite())
                 earliestFireTime = std::min(nextFireTime, earliestFireTime);
-        }
-
-        if (resultElement)
-            animationsToApply.append(resultElement.get());
-    }
+        });
 
-    if (animationsToApply.isEmpty()) {
-#ifndef NDEBUG
-        m_preventScheduledAnimationsChanges = false;
-#endif
-        startTimer(elapsed, earliestFireTime, animationFrameDelay());
-        return;
+        if (firstAnimation)
+            animationsToApply.append(firstAnimation.get());
     }
 
     // Apply results to target elements.
     for (auto& animation : animationsToApply)
         animation->applyResultsToTarget();
 
-#ifndef NDEBUG
-    m_preventScheduledAnimationsChanges = false;
-#endif
-
     startTimer(elapsed, earliestFireTime, animationFrameDelay());
 }
 
index d8fc4f8..6e964cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -42,7 +42,6 @@ class SVGSVGElement;
 class SMILTimeContainer final : public RefCounted<SMILTimeContainer>  {
 public:
     static Ref<SMILTimeContainer> create(SVGSVGElement& owner) { return adoptRef(*new SMILTimeContainer(owner)); }
-    ~SMILTimeContainer();
 
     void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&);
     void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&);
@@ -69,9 +68,15 @@ private:
     void timerFired();
     void startTimer(SMILTime elapsed, SMILTime fireTime, SMILTime minimumDelay = 0);
     void updateAnimations(SMILTime elapsed, bool seekToTime = false);
-    
+
+    typedef std::pair<SVGElement*, QualifiedName> ElementAttributePair;
+    typedef Vector<SVGSMILElement*> AnimationsVector;
+    typedef HashMap<ElementAttributePair, std::unique_ptr<AnimationsVector>> GroupedAnimationsMap;
+
+    void processAnimations(const AnimationsVector&, Function<void(SVGSMILElement*)>&&);
+    void processScheduledAnimations(Function<void(SVGSMILElement*)>&&);
     void updateDocumentOrderIndexes();
-    void sortByPriority(Vector<SVGSMILElement*>& smilElements, SMILTime elapsed);
+    void sortByPriority(AnimationsVector& smilElements, SMILTime elapsed);
 
     MonotonicTime m_beginTime;
     MonotonicTime m_pauseTime;
@@ -80,19 +85,9 @@ private:
     Seconds m_presetStartTime { 0_s };
 
     bool m_documentOrderIndexesDirty { false };
-    
     Timer m_timer;
-
-    typedef std::pair<SVGElement*, QualifiedName> ElementAttributePair;
-    typedef Vector<SVGSMILElement*> AnimationsVector;
-    typedef HashMap<ElementAttributePair, std::unique_ptr<AnimationsVector>> GroupedAnimationsMap;
     GroupedAnimationsMap m_scheduledAnimations;
-
     SVGSVGElement& m_ownerSVGElement;
-
-#ifndef NDEBUG
-    bool m_preventScheduledAnimationsChanges { false };
-#endif
 };
 
 } // namespace WebCore
index afa9329..3ab5829 100644 (file)
@@ -1040,8 +1040,7 @@ float SVGSMILElement::calculateAnimationPercentAndRepeat(SMILTime elapsed, unsig
     
 SMILTime SVGSMILElement::calculateNextProgressTime(SMILTime elapsed) const
 {
-    ASSERT(m_timeContainer);
-    if (m_activeState == Active) {
+    if (m_timeContainer && m_activeState == Active) {
         // If duration is indefinite the value does not actually change over time. Same is true for <set>.
         SMILTime simpleDuration = this->simpleDuration();
         if (simpleDuration.isIndefinite() || hasTagName(SVGNames::setTag)) {
index 99b2aa9..512b852 100644 (file)
@@ -53,7 +53,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedBooleanAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedBooleanAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -75,7 +75,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedEnumerationAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedEnumerationAnimator<EnumType>::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -97,7 +97,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedIntegerAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedIntegerAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -121,7 +121,7 @@ public:
 private:
     bool isAnimatedLength() const override { return true; }
 
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         SVGLengthMode lengthMode = property(owner)->baseVal()->value().lengthMode();
         return SVGAnimatedLengthAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
@@ -144,7 +144,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedLengthListAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedLengthListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Width);
     }
@@ -166,7 +166,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedNumberAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedNumberAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -188,7 +188,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedNumberListAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedNumberListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -210,7 +210,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPathSegListAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedPathSegListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -232,7 +232,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPointListAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedPointListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -264,7 +264,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedPreserveAspectRatioAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedPreserveAspectRatioAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -286,7 +286,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedRectAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedRectAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -308,7 +308,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedStringAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedStringAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -330,7 +330,7 @@ public:
     constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGAnimatedTransformListAccessor, property>(); }
 
 private:
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedTransformListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
index d0737ac..81edc53 100644 (file)
@@ -50,7 +50,7 @@ class SVGAnimatedAngleAnimator final : public SVGAnimatedPropertyAnimator<SVGAni
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedAngle>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedAngleAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedAngleAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -68,7 +68,7 @@ public:
 
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedBoolean>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedBooleanAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedBooleanAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -89,7 +89,7 @@ class SVGAnimatedEnumerationAnimator final : public SVGAnimatedPropertyAnimator<
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedEnumeration>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedEnumerationAnimator<EnumType>>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedEnumerationAnimator<EnumType>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -111,7 +111,7 @@ public:
 
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedInteger>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedIntegerAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedIntegerAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -132,7 +132,7 @@ public:
 
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLength>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
     {
-        return makeUnique<SVGAnimatedLengthAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
+        return adoptRef(*new SVGAnimatedLengthAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode));
     }
 
 private:
@@ -153,7 +153,7 @@ public:
 
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLengthList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
     {
-        return makeUnique<SVGAnimatedLengthListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
+        return adoptRef(*new SVGAnimatedLengthListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode));
     }
 
 private:
@@ -172,7 +172,7 @@ class SVGAnimatedNumberAnimator final : public SVGAnimatedPropertyAnimator<SVGAn
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumber>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedNumberAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedNumberAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -189,7 +189,7 @@ class SVGAnimatedNumberListAnimator final : public SVGAnimatedPropertyAnimator<S
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumberList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedNumberListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedNumberListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
     
 private:
@@ -206,7 +206,7 @@ class SVGAnimatedPathSegListAnimator final : public SVGAnimatedPropertyAnimator<
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPathSegList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedPathSegListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedPathSegListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -224,7 +224,7 @@ class SVGAnimatedPointListAnimator final : public SVGAnimatedPropertyAnimator<SV
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPointList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedPointListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedPointListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
     
 private:
@@ -243,7 +243,7 @@ class SVGAnimatedOrientTypeAnimator final : public SVGAnimatedPropertyAnimator<S
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedOrientType>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedOrientTypeAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedOrientTypeAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -262,7 +262,7 @@ class SVGAnimatedPreserveAspectRatioAnimator final : public SVGAnimatedPropertyA
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPreserveAspectRatio>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedPreserveAspectRatioAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedPreserveAspectRatioAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -281,7 +281,7 @@ public:
 
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedRect>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedRectAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedRectAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -298,7 +298,7 @@ class SVGAnimatedStringAnimator final : public SVGAnimatedPropertyAnimator<SVGAn
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedString>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedStringAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedStringAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -338,7 +338,7 @@ class SVGAnimatedTransformListAnimator final : public SVGAnimatedPropertyAnimato
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedTransformList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedTransformListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedTransformListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
index d47e4ae..4a269fa 100644 (file)
@@ -60,7 +60,7 @@ private:
         return type == SVGMarkerOrientAuto || type == SVGMarkerOrientAutoStartReverse ? string2 : string1;
     }
 
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedAngleOrientAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -95,7 +95,7 @@ private:
         return string1 == string2 ? string1 : string1 + ", " + string2;
     }
 
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedIntegerPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
@@ -130,7 +130,7 @@ private:
         return string1 == string2 ? string1 : string1 + ", " + string2;
     }
 
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
+    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     {
         return SVGAnimatedNumberPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive);
     }
index c723acf..55d5692 100644 (file)
@@ -74,8 +74,8 @@ protected:
         m_animatedPropertyAnimator2->stop(targetElement);
     }
 
-    std::unique_ptr<AnimatedPropertyAnimator1> m_animatedPropertyAnimator1;
-    std::unique_ptr<AnimatedPropertyAnimator2> m_animatedPropertyAnimator2;
+    Ref<AnimatedPropertyAnimator1> m_animatedPropertyAnimator1;
+    Ref<AnimatedPropertyAnimator2> m_animatedPropertyAnimator2;
 };
 
 }
index 397ff09..faf93fb 100644 (file)
@@ -40,7 +40,7 @@ class SVGAnimatedAngleOrientAnimator final : public SVGAnimatedPropertyPairAnima
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedAngle>& animated1, Ref<SVGAnimatedOrientType>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedAngleOrientAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedAngleOrientAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -113,7 +113,7 @@ class SVGAnimatedIntegerPairAnimator final : public SVGAnimatedPropertyPairAnima
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedInteger>& animated1, Ref<SVGAnimatedInteger>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedIntegerPairAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedIntegerPairAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
@@ -156,7 +156,7 @@ class SVGAnimatedNumberPairAnimator final : public SVGAnimatedPropertyPairAnimat
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumber>& animated1, Ref<SVGAnimatedNumber>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGAnimatedNumberPairAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGAnimatedNumberPairAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive));
     }
 
 private:
index 022eded..fbc15a8 100644 (file)
@@ -51,7 +51,7 @@ enum class CalcMode : uint8_t {
     Spline
 };
 
-class SVGAttributeAnimator {
+class SVGAttributeAnimator : public RefCounted<SVGAttributeAnimator> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     SVGAttributeAnimator(const QualifiedName& attributeName)
index 7dc4caa..f7bba6a 100644 (file)
@@ -47,7 +47,7 @@ public:
     virtual bool matches(const OwnerType&, const SVGAnimatedProperty&) const { return false; }
     virtual Optional<String> synchronize(const OwnerType&) const { return WTF::nullopt; }
 
-    virtual std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType&, const QualifiedName&, AnimationMode, CalcMode, bool, bool) const { return nullptr; }
+    virtual RefPtr<SVGAttributeAnimator> createAnimator(OwnerType&, const QualifiedName&, AnimationMode, CalcMode, bool, bool) const { return nullptr; }
     virtual void appendAnimatedInstance(OwnerType&, SVGAttributeAnimator&) const { }
 
 protected:
index 68b2e0b..1f2374f 100644 (file)
@@ -44,7 +44,7 @@ class SVGPrimitivePropertyAnimator : public SVGPropertyAnimator<AnimationFunctio
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGPrimitivePropertyAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
+        return adoptRef(*new SVGPrimitivePropertyAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive));
     }
     
     template<typename... Arguments>
index 5e3018f..681e6dc 100644 (file)
@@ -43,7 +43,7 @@ public:
         return attributeAnimatorCreator().contains(attributeName.impl());
     }
 
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
+    RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
         auto iterator = attributeAnimatorCreator().find(attributeName.impl());
         if (iterator == attributeAnimatorCreator().end())
@@ -75,7 +75,7 @@ private:
         QualifiedName::QualifiedNameImpl*,
         std::pair<
             std::function<Ref<SVGProperty>()>,
-            std::function<std::unique_ptr<SVGAttributeAnimator>(const QualifiedName&, Ref<SVGProperty>&&, AnimationMode, CalcMode, bool, bool)>
+            std::function<Ref<SVGAttributeAnimator>(const QualifiedName&, Ref<SVGProperty>&&, AnimationMode, CalcMode, bool, bool)>
         >
     >;
 
index 12ce696..a5f7136 100644 (file)
@@ -266,9 +266,9 @@ public:
         return isAnimatedLengthAttribute(attributeName) && animatedStyleAttributes.get().contains(attributeName.impl());
     }
 
-    std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const override
+    RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const override
     {
-        std::unique_ptr<SVGAttributeAnimator> animator;
+        RefPtr<SVGAttributeAnimator> animator;
         enumerateRecursively([&](const auto& entry) -> bool {
             if (!entry.key.matches(attributeName))
                 return true;
index 92f7ab0..24fe642 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     virtual bool isAnimatedPropertyAttribute(const QualifiedName&) const = 0;
     virtual bool isAnimatedStylePropertyAttribute(const QualifiedName&) const = 0;
-    virtual std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive) const = 0;
+    virtual RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive) const = 0;
     virtual void appendAnimatedInstance(const QualifiedName& attributeName, SVGAttributeAnimator&) const = 0;
 };
 
index 6276784..e696260 100644 (file)
@@ -39,7 +39,7 @@ class SVGLengthAnimator final : public SVGValuePropertyAnimator<SVGLength, SVGAn
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGLengthAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other);
+        return adoptRef(*new SVGLengthAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other));
     }
 
     void start(SVGElement* targetElement) override
index 1598f56..2e2a854 100644 (file)
@@ -39,7 +39,7 @@ class SVGLengthListAnimator final : public SVGValuePropertyListAnimator<SVGLengt
 public:
     static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     {
-        return makeUnique<SVGLengthListAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other);
+        return adoptRef(*new SVGLengthListAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other));
     }
 
     void start(SVGElement* targetElement) override