Changeset 251809 in webkit


Ignore:
Timestamp:
Oct 30, 2019 3:15:17 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Remove the argument 'resultElement' from the SVG animation functions
https://bugs.webkit.org/show_bug.cgi?id=202052

Reviewed by Simon Fraser.

This is a clean-up patch, which does the following:

-- It removes the argument 'resultElement' from all the SVG animation

functions except from SVGSMILElement::progress(). In this function, we
need to start the animation only with the first animation.

-- It renames resetAnimatedType() and clearAnimatedType() to startAnimation()

and stopAnimation() respectively. These functions were named for the
type SVGAnimatedType which had been deleted. The real purpose of these
functions is to start/stop the animation.

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-30

  • svg/SVGAnimateElementBase.cpp:

(WebCore::SVGAnimateElementBase::startAnimation):
(WebCore::SVGAnimateElementBase::calculateAnimatedValue):
(WebCore::SVGAnimateElementBase::stopAnimation):
(WebCore::SVGAnimateElementBase::resetAnimatedType): Deleted.
(WebCore::SVGAnimateElementBase::clearAnimatedType): Deleted.

  • svg/SVGAnimateElementBase.h:
  • svg/SVGAnimateMotionElement.cpp:

(WebCore::SVGAnimateMotionElement::startAnimation):
(WebCore::SVGAnimateMotionElement::stopAnimation):
(WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
(WebCore::SVGAnimateMotionElement::resetAnimatedType): Deleted.
(WebCore::SVGAnimateMotionElement::clearAnimatedType): Deleted.

  • svg/SVGAnimateMotionElement.h:
  • svg/SVGAnimationElement.cpp:

(WebCore::SVGAnimationElement::updateAnimation):

  • svg/SVGAnimationElement.h:
  • svg/animation/SMILTimeContainer.cpp:

(WebCore::SMILTimeContainer::updateAnimations):

  • svg/animation/SVGSMILElement.cpp:

(WebCore::SVGSMILElement::reset):
(WebCore::SVGSMILElement::setAttributeName):
(WebCore::SVGSMILElement::setTargetElement):
(WebCore::SVGSMILElement::progress):

  • svg/animation/SVGSMILElement.h:
Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r251799 r251809  
     12019-10-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Remove the argument 'resultElement' from the SVG animation functions
     4        https://bugs.webkit.org/show_bug.cgi?id=202052
     5
     6         Reviewed by Simon Fraser.
     7
     8         This is a clean-up patch, which does the following:
     9
     10         -- It removes the argument 'resultElement' from all the SVG animation
     11           functions except from SVGSMILElement::progress(). In this function, we
     12           need to start the animation only with the first animation.
     13
     14         -- It renames resetAnimatedType() and clearAnimatedType() to startAnimation()
     15           and stopAnimation() respectively. These functions were named for the
     16           type SVGAnimatedType which had been deleted. The real purpose of these
     17           functions is to start/stop the animation.
     18
     19        * svg/SVGAnimateElementBase.cpp:
     20        (WebCore::SVGAnimateElementBase::startAnimation):
     21        (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
     22        (WebCore::SVGAnimateElementBase::stopAnimation):
     23        (WebCore::SVGAnimateElementBase::resetAnimatedType): Deleted.
     24        (WebCore::SVGAnimateElementBase::clearAnimatedType): Deleted.
     25        * svg/SVGAnimateElementBase.h:
     26        * svg/SVGAnimateMotionElement.cpp:
     27        (WebCore::SVGAnimateMotionElement::startAnimation):
     28        (WebCore::SVGAnimateMotionElement::stopAnimation):
     29        (WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
     30        (WebCore::SVGAnimateMotionElement::resetAnimatedType): Deleted.
     31        (WebCore::SVGAnimateMotionElement::clearAnimatedType): Deleted.
     32        * svg/SVGAnimateMotionElement.h:
     33        * svg/SVGAnimationElement.cpp:
     34        (WebCore::SVGAnimationElement::updateAnimation):
     35        * svg/SVGAnimationElement.h:
     36        * svg/animation/SMILTimeContainer.cpp:
     37        (WebCore::SMILTimeContainer::updateAnimations):
     38        * svg/animation/SVGSMILElement.cpp:
     39        (WebCore::SVGSMILElement::reset):
     40        (WebCore::SVGSMILElement::setAttributeName):
     41        (WebCore::SVGSMILElement::setTargetElement):
     42        (WebCore::SVGSMILElement::progress):
     43        * svg/animation/SVGSMILElement.h:
     44
    1452019-10-30  Zalan Bujtas  <zalan@apple.com>
    246
  • trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp

    r250488 r251809  
    147147}
    148148
    149 void SVGAnimateElementBase::resetAnimatedType()
     149void SVGAnimateElementBase::startAnimation()
    150150{
    151151    if (!targetElement())
     
    156156}
    157157
    158 void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount, SVGSMILElement*)
     158void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount)
    159159{
    160160    if (!targetElement())
     
    181181}
    182182
    183 void SVGAnimateElementBase::clearAnimatedType(SVGElement* targetElement)
     183void SVGAnimateElementBase::stopAnimation(SVGElement* targetElement)
    184184{
    185185    if (!targetElement)
  • trunk/Source/WebCore/svg/SVGAnimateElementBase.h

    r250488 r251809  
    5454    bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override;
    5555
    56     void resetAnimatedType() override;
    57     void calculateAnimatedValue(float progress, unsigned repeatCount, SVGSMILElement* resultElement) override;
     56    void startAnimation() override;
     57    void calculateAnimatedValue(float progress, unsigned repeatCount) override;
    5858    void applyResultsToTarget() override;
    59     void clearAnimatedType(SVGElement* targetElement) override;
     59    void stopAnimation(SVGElement* targetElement) override;
    6060    Optional<float> calculateDistance(const String& fromString, const String& toString) override;
    6161
  • trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp

    r249974 r251809  
    140140}
    141141
    142 void SVGAnimateMotionElement::resetAnimatedType()
     142void SVGAnimateMotionElement::startAnimation()
    143143{
    144144    if (!hasValidAttributeType())
     
    151151}
    152152
    153 void SVGAnimateMotionElement::clearAnimatedType(SVGElement* targetElement)
     153void SVGAnimateMotionElement::stopAnimation(SVGElement* targetElement)
    154154{
    155155    if (!targetElement)
     
    209209}
    210210
    211 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*)
     211void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount)
    212212{
    213213    auto targetElement = makeRefPtr(this->targetElement());
  • trunk/Source/WebCore/svg/SVGAnimateMotionElement.h

    r246490 r251809  
    4242    void parseAttribute(const QualifiedName&, const AtomString&) override;
    4343
    44     void resetAnimatedType() override;
    45     void clearAnimatedType(SVGElement* targetElement) override;
     44    void startAnimation() override;
     45    void stopAnimation(SVGElement* targetElement) override;
    4646    bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override;
    4747    bool calculateFromAndToValues(const String& fromString, const String& toString) override;
    4848    bool calculateFromAndByValues(const String& fromString, const String& byString) override;
    49     void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement* resultElement) override;
     49    void calculateAnimatedValue(float percentage, unsigned repeatCount) override;
    5050    void applyResultsToTarget() override;
    5151    Optional<float> calculateDistance(const String& fromString, const String& toString) override;
  • trunk/Source/WebCore/svg/SVGAnimationElement.cpp

    r251318 r251809  
    563563}
    564564
    565 void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount, SVGSMILElement* resultElement)
     565void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount)
    566566{   
    567567    if (!m_animationValid)
     
    591591        effectivePercent = percent;
    592592
    593     calculateAnimatedValue(effectivePercent, repeatCount, resultElement);
     593    calculateAnimatedValue(effectivePercent, repeatCount);
    594594}
    595595
  • trunk/Source/WebCore/svg/SVGAnimationElement.h

    r251318 r251809  
    103103    // from SVGSMILElement
    104104    void startedActiveInterval() override;
    105     void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) override;
     105    void updateAnimation(float percent, unsigned repeat) override;
    106106
    107107    AnimatedPropertyValueType m_fromPropertyValueType { RegularPropertyValue };
     
    121121    virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0;
    122122    virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0;
    123     virtual void calculateAnimatedValue(float percent, unsigned repeatCount, SVGSMILElement* resultElement) = 0;
     123    virtual void calculateAnimatedValue(float percent, unsigned repeatCount) = 0;
    124124    virtual Optional<float> calculateDistance(const String& /*fromString*/, const String& /*toString*/) = 0;
    125125
  • trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp

    r250488 r251809  
    279279
    280280            // This will calculate the contribution from the animation and add it to the resultsElement.
    281             if (!animation->progress(elapsed, firstAnimation.get(), seekToTime) && firstAnimation == animation)
     281            if (!animation->progress(elapsed, *firstAnimation, seekToTime) && firstAnimation == animation)
    282282                firstAnimation = nullptr;
    283283
  • trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp

    r250488 r251809  
    246246void SVGSMILElement::reset()
    247247{
    248     clearAnimatedType(m_targetElement);
     248    stopAnimation(m_targetElement);
    249249
    250250    m_activeState = Inactive;
     
    611611    // Only clear the animated type, if we had a target before.
    612612    if (m_targetElement)
    613         clearAnimatedType(m_targetElement);
     613        stopAnimation(m_targetElement);
    614614}
    615615
     
    625625    if (m_targetElement) {
    626626        // Clear values that may depend on the previous target.
    627         clearAnimatedType(m_targetElement);
     627        stopAnimation(m_targetElement);
    628628        disconnectConditions();
    629629    }
     
    10711071}
    10721072   
    1073 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, bool seekToTime)
    1074 {
    1075     ASSERT(resultElement);
     1073bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement& firstAnimation, bool seekToTime)
     1074{
    10761075    ASSERT(m_timeContainer);
    10771076    ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite());
     
    10861085        ASSERT(m_activeState != Active);
    10871086        if (m_activeState == Frozen) {
    1088             if (this == resultElement)
    1089                 resetAnimatedType();
    1090             updateAnimation(m_lastPercent, m_lastRepeat, resultElement);
     1087            if (this == &firstAnimation)
     1088                startAnimation();
     1089            updateAnimation(m_lastPercent, m_lastRepeat);
    10911090        }
    10921091        m_nextProgressTime = m_intervalBegin;
     
    11191118    bool animationIsContributing = isContributing(elapsed);
    11201119
    1121     // Only reset the animated type to the base value once for the lowest priority animation that animates and contributes to a particular element/attribute pair.
    1122     if (this == resultElement && animationIsContributing)
    1123         resetAnimatedType();
    1124 
    11251120    if (animationIsContributing) {
     1121        // Only start the animation of the lowest priority animation that animates and contributes to a particular element/attribute pair.
     1122        if (this == &firstAnimation)
     1123            startAnimation();
     1124
    11261125        if (oldActiveState == Inactive)
    11271126            startedActiveInterval();
    11281127
    1129         updateAnimation(percent, repeat, resultElement);
     1128        updateAnimation(percent, repeat);
    11301129        m_lastPercent = percent;
    11311130        m_lastRepeat = repeat;
     
    11361135        endedActiveInterval();
    11371136        if (m_activeState != Frozen)
    1138             clearAnimatedType(m_targetElement);
     1137            stopAnimation(m_targetElement);
    11391138    } else if (oldActiveState != Active && m_activeState == Active)
    11401139        smilBeginEventSender().dispatchEventSoon(*this);
  • trunk/Source/WebCore/svg/animation/SVGSMILElement.h

    r246490 r251809  
    8383
    8484    void seekToIntervalCorrespondingToTime(SMILTime elapsed);
    85     bool progress(SMILTime elapsed, SVGSMILElement* resultsElement, bool seekToTime);
     85    bool progress(SMILTime elapsed, SVGSMILElement& firstAnimation, bool seekToTime);
    8686    SMILTime nextProgressTime() const;
    8787
     
    9999
    100100    virtual bool isAdditive() const = 0;
    101     virtual void resetAnimatedType() = 0;
    102     virtual void clearAnimatedType(SVGElement* targetElement) = 0;
     101    virtual void startAnimation() = 0;
     102    virtual void stopAnimation(SVGElement* targetElement) = 0;
    103103    virtual void applyResultsToTarget() = 0;
    104104
     
    130130    virtual void startedActiveInterval() = 0;
    131131    void endedActiveInterval();
    132     virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) = 0;
     132    virtual void updateAnimation(float percent, unsigned repeat) = 0;
    133133
    134134    static bool isSupportedAttribute(const QualifiedName&);
Note: See TracChangeset for help on using the changeset viewer.