Changeset 251809 in webkit
- Timestamp:
- Oct 30, 2019 3:15:17 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251799 r251809 1 2019-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 1 45 2019-10-30 Zalan Bujtas <zalan@apple.com> 2 46 -
trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp
r250488 r251809 147 147 } 148 148 149 void SVGAnimateElementBase:: resetAnimatedType()149 void SVGAnimateElementBase::startAnimation() 150 150 { 151 151 if (!targetElement()) … … 156 156 } 157 157 158 void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount , SVGSMILElement*)158 void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount) 159 159 { 160 160 if (!targetElement()) … … 181 181 } 182 182 183 void SVGAnimateElementBase:: clearAnimatedType(SVGElement* targetElement)183 void SVGAnimateElementBase::stopAnimation(SVGElement* targetElement) 184 184 { 185 185 if (!targetElement) -
trunk/Source/WebCore/svg/SVGAnimateElementBase.h
r250488 r251809 54 54 bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override; 55 55 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; 58 58 void applyResultsToTarget() override; 59 void clearAnimatedType(SVGElement* targetElement) override;59 void stopAnimation(SVGElement* targetElement) override; 60 60 Optional<float> calculateDistance(const String& fromString, const String& toString) override; 61 61 -
trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp
r249974 r251809 140 140 } 141 141 142 void SVGAnimateMotionElement:: resetAnimatedType()142 void SVGAnimateMotionElement::startAnimation() 143 143 { 144 144 if (!hasValidAttributeType()) … … 151 151 } 152 152 153 void SVGAnimateMotionElement:: clearAnimatedType(SVGElement* targetElement)153 void SVGAnimateMotionElement::stopAnimation(SVGElement* targetElement) 154 154 { 155 155 if (!targetElement) … … 209 209 } 210 210 211 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount , SVGSMILElement*)211 void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount) 212 212 { 213 213 auto targetElement = makeRefPtr(this->targetElement()); -
trunk/Source/WebCore/svg/SVGAnimateMotionElement.h
r246490 r251809 42 42 void parseAttribute(const QualifiedName&, const AtomString&) override; 43 43 44 void resetAnimatedType() override;45 void clearAnimatedType(SVGElement* targetElement) override;44 void startAnimation() override; 45 void stopAnimation(SVGElement* targetElement) override; 46 46 bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override; 47 47 bool calculateFromAndToValues(const String& fromString, const String& toString) override; 48 48 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; 50 50 void applyResultsToTarget() override; 51 51 Optional<float> calculateDistance(const String& fromString, const String& toString) override; -
trunk/Source/WebCore/svg/SVGAnimationElement.cpp
r251318 r251809 563 563 } 564 564 565 void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount , SVGSMILElement* resultElement)565 void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount) 566 566 { 567 567 if (!m_animationValid) … … 591 591 effectivePercent = percent; 592 592 593 calculateAnimatedValue(effectivePercent, repeatCount , resultElement);593 calculateAnimatedValue(effectivePercent, repeatCount); 594 594 } 595 595 -
trunk/Source/WebCore/svg/SVGAnimationElement.h
r251318 r251809 103 103 // from SVGSMILElement 104 104 void startedActiveInterval() override; 105 void updateAnimation(float percent, unsigned repeat , SVGSMILElement* resultElement) override;105 void updateAnimation(float percent, unsigned repeat) override; 106 106 107 107 AnimatedPropertyValueType m_fromPropertyValueType { RegularPropertyValue }; … … 121 121 virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0; 122 122 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; 124 124 virtual Optional<float> calculateDistance(const String& /*fromString*/, const String& /*toString*/) = 0; 125 125 -
trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp
r250488 r251809 279 279 280 280 // 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) 282 282 firstAnimation = nullptr; 283 283 -
trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp
r250488 r251809 246 246 void SVGSMILElement::reset() 247 247 { 248 clearAnimatedType(m_targetElement);248 stopAnimation(m_targetElement); 249 249 250 250 m_activeState = Inactive; … … 611 611 // Only clear the animated type, if we had a target before. 612 612 if (m_targetElement) 613 clearAnimatedType(m_targetElement);613 stopAnimation(m_targetElement); 614 614 } 615 615 … … 625 625 if (m_targetElement) { 626 626 // Clear values that may depend on the previous target. 627 clearAnimatedType(m_targetElement);627 stopAnimation(m_targetElement); 628 628 disconnectConditions(); 629 629 } … … 1071 1071 } 1072 1072 1073 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, bool seekToTime) 1074 { 1075 ASSERT(resultElement); 1073 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement& firstAnimation, bool seekToTime) 1074 { 1076 1075 ASSERT(m_timeContainer); 1077 1076 ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite()); … … 1086 1085 ASSERT(m_activeState != Active); 1087 1086 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); 1091 1090 } 1092 1091 m_nextProgressTime = m_intervalBegin; … … 1119 1118 bool animationIsContributing = isContributing(elapsed); 1120 1119 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 1125 1120 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 1126 1125 if (oldActiveState == Inactive) 1127 1126 startedActiveInterval(); 1128 1127 1129 updateAnimation(percent, repeat , resultElement);1128 updateAnimation(percent, repeat); 1130 1129 m_lastPercent = percent; 1131 1130 m_lastRepeat = repeat; … … 1136 1135 endedActiveInterval(); 1137 1136 if (m_activeState != Frozen) 1138 clearAnimatedType(m_targetElement);1137 stopAnimation(m_targetElement); 1139 1138 } else if (oldActiveState != Active && m_activeState == Active) 1140 1139 smilBeginEventSender().dispatchEventSoon(*this); -
trunk/Source/WebCore/svg/animation/SVGSMILElement.h
r246490 r251809 83 83 84 84 void seekToIntervalCorrespondingToTime(SMILTime elapsed); 85 bool progress(SMILTime elapsed, SVGSMILElement * resultsElement, bool seekToTime);85 bool progress(SMILTime elapsed, SVGSMILElement& firstAnimation, bool seekToTime); 86 86 SMILTime nextProgressTime() const; 87 87 … … 99 99 100 100 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; 103 103 virtual void applyResultsToTarget() = 0; 104 104 … … 130 130 virtual void startedActiveInterval() = 0; 131 131 void endedActiveInterval(); 132 virtual void updateAnimation(float percent, unsigned repeat , SVGSMILElement* resultElement) = 0;132 virtual void updateAnimation(float percent, unsigned repeat) = 0; 133 133 134 134 static bool isSupportedAttribute(const QualifiedName&);
Note: See TracChangeset
for help on using the changeset viewer.