Changeset 250488 in webkit


Ignore:
Timestamp:
Sep 28, 2019 10:16:58 PM (5 years ago)
Author:
Said Abou-Hallawa
Message:

Crash when removing the target element while animating its attributes
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.
Location:
trunk
Files:
2 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r250464 r250488  
     12019-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
    1112019-09-27  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r250487 r250488  
     12019-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
    1622019-09-28  Zalan Bujtas  <zalan@apple.com>
    263
  • trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp

    r250175 r250488  
    152152        return;
    153153
    154     if (auto* animator = this->animator())
    155         animator->start(targetElement());
     154    if (auto protectedAnimator = makeRefPtr(this->animator()))
     155        protectedAnimator->start(targetElement());
    156156}
    157157
     
    168168        progress = progress < 0.5 ? 0 : 1;
    169169
    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);
    172172}
    173173
  • trunk/Source/WebCore/svg/SVGAnimateElementBase.h

    r250175 r250488  
    6262    bool hasInvalidCSSAttributeType() const;
    6363
    64     mutable std::unique_ptr<SVGAttributeAnimator> m_animator;
     64    mutable RefPtr<SVGAttributeAnimator> m_animator;
    6565    mutable Optional<bool> m_hasInvalidCSSAttributeType;
    6666};
  • trunk/Source/WebCore/svg/SVGElement.cpp

    r248983 r250488  
    605605}
    606606
    607 std::unique_ptr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
     607RefPtr<SVGAttributeAnimator> SVGElement::createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    608608{
    609609    // Property animator, e.g. "fill" or "fill-opacity".
  • trunk/Source/WebCore/svg/SVGElement.h

    r248983 r250488  
    142142    const SVGElement* attributeContextElement() const override { return this; }
    143143    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);
    145145    void animatorWillBeDeleted(const QualifiedName&);
    146146
  • trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp

    r248846 r250488  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4545}
    4646
    47 SMILTimeContainer::~SMILTimeContainer()
    48 {
    49 #ifndef NDEBUG
    50     ASSERT(!m_preventScheduledAnimationsChanges);
    51 #endif
    52 }
    53 
    5447void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target, const QualifiedName& attributeName)
    5548{
     
    5750    ASSERT(target);
    5851    ASSERT(animation->hasValidAttributeName());
    59 
    60 #ifndef NDEBUG
    61     ASSERT(!m_preventScheduledAnimationsChanges);
    62 #endif
    6352
    6453    ElementAttributePair key(target, attributeName);
     
    7867    ASSERT(animation->timeContainer() == this);
    7968
    80 #ifndef NDEBUG
    81     ASSERT(!m_preventScheduledAnimationsChanges);
    82 #endif
    83 
    8469    ElementAttributePair key(target, attributeName);
    8570    AnimationsVector* scheduled = m_scheduledAnimations.get(key);
     
    185170        m_resumeTime = m_beginTime;
    186171
    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    });
    197175
    198176    updateAnimations(time, true);
     
    245223};
    246224
    247 void SMILTimeContainer::sortByPriority(Vector<SVGSMILElement*>& smilElements, SMILTime elapsed)
     225void SMILTimeContainer::sortByPriority(AnimationsVector& animations, SMILTime elapsed)
    248226{
    249227    if (m_documentOrderIndexesDirty)
    250228        updateDocumentOrderIndexes();
    251     std::sort(smilElements.begin(), smilElements.end(), PriorityCompare(elapsed));
     229    std::sort(animations.begin(), animations.end(), PriorityCompare(elapsed));
     230}
     231
     232void 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
     241void SMILTimeContainer::processScheduledAnimations(Function<void(SVGSMILElement*)>&& callback)
     242{
     243    for (auto& it : m_scheduledAnimations)
     244        processAnimations(*it.value, WTFMove(callback));
    252245}
    253246
    254247void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
    255248{
    256     SMILTime earliestFireTime = SMILTime::unresolved();
    257 
    258249    // Don't mutate the DOM while updating the animations.
    259250    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    });
    266256
    267257    AnimationsVector animationsToApply;
     258    SMILTime earliestFireTime = SMILTime::unresolved();
     259
    268260    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 
    279261        // 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.
    281263        // FIXME: This should also consider timing relationships between the elements. Dependents
    282264        // 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) {
    287269            ASSERT(animation->timeContainer() == this);
    288270            ASSERT(animation->targetElement());
     
    290272
    291273            // Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair.
    292             if (!resultElement) {
     274            if (!firstAnimation) {
    293275                if (!animation->hasValidAttributeType())
    294                     continue;
    295                 resultElement = animation;
     276                    return;
     277                firstAnimation = animation;
    296278            }
    297279
    298280            // 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;
    301283
    302284            SMILTime nextFireTime = animation->nextProgressTime();
    303285            if (nextFireTime.isFinite())
    304286                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());
    317291    }
    318292
     
    321295        animation->applyResultsToTarget();
    322296
    323 #ifndef NDEBUG
    324     m_preventScheduledAnimationsChanges = false;
    325 #endif
    326 
    327297    startTimer(elapsed, earliestFireTime, animationFrameDelay());
    328298}
  • trunk/Source/WebCore/svg/animation/SMILTimeContainer.h

    r229174 r250488  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4343public:
    4444    static Ref<SMILTimeContainer> create(SVGSVGElement& owner) { return adoptRef(*new SMILTimeContainer(owner)); }
    45     ~SMILTimeContainer();
    4645
    4746    void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&);
     
    7069    void startTimer(SMILTime elapsed, SMILTime fireTime, SMILTime minimumDelay = 0);
    7170    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*)>&&);
    7378    void updateDocumentOrderIndexes();
    74     void sortByPriority(Vector<SVGSMILElement*>& smilElements, SMILTime elapsed);
     79    void sortByPriority(AnimationsVector& smilElements, SMILTime elapsed);
    7580
    7681    MonotonicTime m_beginTime;
     
    8186
    8287    bool m_documentOrderIndexesDirty { false };
    83    
    8488    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;
    8989    GroupedAnimationsMap m_scheduledAnimations;
    90 
    9190    SVGSVGElement& m_ownerSVGElement;
    92 
    93 #ifndef NDEBUG
    94     bool m_preventScheduledAnimationsChanges { false };
    95 #endif
    9691};
    9792
  • trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp

    r249216 r250488  
    10411041SMILTime SVGSMILElement::calculateNextProgressTime(SMILTime elapsed) const
    10421042{
    1043     ASSERT(m_timeContainer);
    1044     if (m_activeState == Active) {
     1043    if (m_timeContainer && m_activeState == Active) {
    10451044        // If duration is indefinite the value does not actually change over time. Same is true for <set>.
    10461045        SMILTime simpleDuration = this->simpleDuration();
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAccessorImpl.h

    r249822 r250488  
    5454
    5555private:
    56     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     56    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    5757    {
    5858        return SVGAnimatedBooleanAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    7676
    7777private:
    78     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     78    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    7979    {
    8080        return SVGAnimatedEnumerationAnimator<EnumType>::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    9898
    9999private:
    100     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     100    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    101101    {
    102102        return SVGAnimatedIntegerAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    122122    bool isAnimatedLength() const override { return true; }
    123123
    124     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     124    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    125125    {
    126126        SVGLengthMode lengthMode = property(owner)->baseVal()->value().lengthMode();
     
    145145
    146146private:
    147     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     147    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    148148    {
    149149        return SVGAnimatedLengthListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Width);
     
    167167
    168168private:
    169     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     169    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    170170    {
    171171        return SVGAnimatedNumberAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    189189
    190190private:
    191     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     191    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    192192    {
    193193        return SVGAnimatedNumberListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    211211
    212212private:
    213     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     213    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    214214    {
    215215        return SVGAnimatedPathSegListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    233233
    234234private:
    235     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     235    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    236236    {
    237237        return SVGAnimatedPointListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    265265
    266266private:
    267     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     267    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    268268    {
    269269        return SVGAnimatedPreserveAspectRatioAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    287287
    288288private:
    289     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     289    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    290290    {
    291291        return SVGAnimatedRectAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    309309
    310310private:
    311     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     311    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    312312    {
    313313        return SVGAnimatedStringAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    331331
    332332private:
    333     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     333    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    334334    {
    335335        return SVGAnimatedTransformListAnimator::create(attributeName, property(owner), animationMode, calcMode, isAccumulated, isAdditive);
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h

    r248846 r250488  
    5151    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedAngle>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    5252    {
    53         return makeUnique<SVGAnimatedAngleAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     53        return adoptRef(*new SVGAnimatedAngleAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    5454    }
    5555
     
    6969    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedBoolean>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    7070    {
    71         return makeUnique<SVGAnimatedBooleanAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     71        return adoptRef(*new SVGAnimatedBooleanAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    7272    }
    7373
     
    9090    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedEnumeration>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    9191    {
    92         return makeUnique<SVGAnimatedEnumerationAnimator<EnumType>>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     92        return adoptRef(*new SVGAnimatedEnumerationAnimator<EnumType>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    9393    }
    9494
     
    112112    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedInteger>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    113113    {
    114         return makeUnique<SVGAnimatedIntegerAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     114        return adoptRef(*new SVGAnimatedIntegerAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    115115    }
    116116
     
    133133    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLength>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
    134134    {
    135         return makeUnique<SVGAnimatedLengthAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
     135        return adoptRef(*new SVGAnimatedLengthAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode));
    136136    }
    137137
     
    154154    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedLengthList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive, SVGLengthMode lengthMode)
    155155    {
    156         return makeUnique<SVGAnimatedLengthListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode);
     156        return adoptRef(*new SVGAnimatedLengthListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive, lengthMode));
    157157    }
    158158
     
    173173    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumber>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    174174    {
    175         return makeUnique<SVGAnimatedNumberAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     175        return adoptRef(*new SVGAnimatedNumberAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    176176    }
    177177
     
    190190    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumberList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    191191    {
    192         return makeUnique<SVGAnimatedNumberListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     192        return adoptRef(*new SVGAnimatedNumberListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    193193    }
    194194   
     
    207207    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPathSegList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    208208    {
    209         return makeUnique<SVGAnimatedPathSegListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     209        return adoptRef(*new SVGAnimatedPathSegListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    210210    }
    211211
     
    225225    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPointList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    226226    {
    227         return makeUnique<SVGAnimatedPointListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     227        return adoptRef(*new SVGAnimatedPointListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    228228    }
    229229   
     
    244244    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedOrientType>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    245245    {
    246         return makeUnique<SVGAnimatedOrientTypeAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     246        return adoptRef(*new SVGAnimatedOrientTypeAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    247247    }
    248248
     
    263263    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedPreserveAspectRatio>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    264264    {
    265         return makeUnique<SVGAnimatedPreserveAspectRatioAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     265        return adoptRef(*new SVGAnimatedPreserveAspectRatioAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    266266    }
    267267
     
    282282    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedRect>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    283283    {
    284         return makeUnique<SVGAnimatedRectAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     284        return adoptRef(*new SVGAnimatedRectAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    285285    }
    286286
     
    299299    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedString>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    300300    {
    301         return makeUnique<SVGAnimatedStringAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     301        return adoptRef(*new SVGAnimatedStringAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    302302    }
    303303
     
    339339    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedTransformList>& animated, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    340340    {
    341         return makeUnique<SVGAnimatedTransformListAnimator>(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive);
     341        return adoptRef(*new SVGAnimatedTransformListAnimator(attributeName, animated, animationMode, calcMode, isAccumulated, isAdditive));
    342342    }
    343343
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessorImpl.h

    r243478 r250488  
    6161    }
    6262
    63     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     63    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    6464    {
    6565        return SVGAnimatedAngleOrientAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    9696    }
    9797
    98     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     98    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    9999    {
    100100        return SVGAnimatedIntegerPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive);
     
    131131    }
    132132
    133     std::unique_ptr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
     133    RefPtr<SVGAttributeAnimator> createAnimator(OwnerType& owner, const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const final
    134134    {
    135135        return SVGAnimatedNumberPairAnimator::create(attributeName, property1(owner), property2(owner), animationMode, calcMode, isAccumulated, isAdditive);
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimator.h

    r243830 r250488  
    7575    }
    7676
    77     std::unique_ptr<AnimatedPropertyAnimator1> m_animatedPropertyAnimator1;
    78     std::unique_ptr<AnimatedPropertyAnimator2> m_animatedPropertyAnimator2;
     77    Ref<AnimatedPropertyAnimator1> m_animatedPropertyAnimator1;
     78    Ref<AnimatedPropertyAnimator2> m_animatedPropertyAnimator2;
    7979};
    8080
  • trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h

    r248846 r250488  
    4141    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedAngle>& animated1, Ref<SVGAnimatedOrientType>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    4242    {
    43         return makeUnique<SVGAnimatedAngleOrientAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);
     43        return adoptRef(*new SVGAnimatedAngleOrientAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive));
    4444    }
    4545
     
    114114    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedInteger>& animated1, Ref<SVGAnimatedInteger>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    115115    {
    116         return makeUnique<SVGAnimatedIntegerPairAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);
     116        return adoptRef(*new SVGAnimatedIntegerPairAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive));
    117117    }
    118118
     
    157157    static auto create(const QualifiedName& attributeName, Ref<SVGAnimatedNumber>& animated1, Ref<SVGAnimatedNumber>& animated2, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    158158    {
    159         return makeUnique<SVGAnimatedNumberPairAnimator>(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive);
     159        return adoptRef(*new SVGAnimatedNumberPairAnimator(attributeName, animated1, animated2, animationMode, calcMode, isAccumulated, isAdditive));
    160160    }
    161161
  • trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h

    r248762 r250488  
    5252};
    5353
    54 class SVGAttributeAnimator {
     54class SVGAttributeAnimator : public RefCounted<SVGAttributeAnimator> {
    5555    WTF_MAKE_FAST_ALLOCATED;
    5656public:
  • trunk/Source/WebCore/svg/properties/SVGMemberAccessor.h

    r243130 r250488  
    4848    virtual Optional<String> synchronize(const OwnerType&) const { return WTF::nullopt; }
    4949
    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; }
    5151    virtual void appendAnimatedInstance(OwnerType&, SVGAttributeAnimator&) const { }
    5252
  • trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h

    r248846 r250488  
    4545    static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    4646    {
    47         return makeUnique<SVGPrimitivePropertyAnimator>(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
     47        return adoptRef(*new SVGPrimitivePropertyAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive));
    4848    }
    4949   
  • trunk/Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h

    r248762 r250488  
    4444    }
    4545
    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)
    4747    {
    4848        auto iterator = attributeAnimatorCreator().find(attributeName.impl());
     
    7676        std::pair<
    7777            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)>
    7979        >
    8080    >;
  • trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h

    r243730 r250488  
    267267    }
    268268
    269     std::unique_ptr<SVGAttributeAnimator> createAnimator(const QualifiedName& attributeName, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive) const override
    270     {
    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;
    272272        enumerateRecursively([&](const auto& entry) -> bool {
    273273            if (!entry.key.matches(attributeName))
  • trunk/Source/WebCore/svg/properties/SVGPropertyRegistry.h

    r243478 r250488  
    4545    virtual bool isAnimatedPropertyAttribute(const QualifiedName&) const = 0;
    4646    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;
    4848    virtual void appendAnimatedInstance(const QualifiedName& attributeName, SVGAttributeAnimator&) const = 0;
    4949};
  • trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h

    r249822 r250488  
    4040    static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    4141    {
    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));
    4343    }
    4444
  • trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h

    r249822 r250488  
    4040    static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
    4141    {
    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));
    4343    }
    4444
Note: See TracChangeset for help on using the changeset viewer.