Diff
Modified: trunk/Source/WebCore/ChangeLog (251808 => 251809)
--- trunk/Source/WebCore/ChangeLog 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/ChangeLog 2019-10-30 22:15:17 UTC (rev 251809)
@@ -1,3 +1,47 @@
+2019-10-30 Said Abou-Hallawa <[email protected]>
+
+ 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.
+
+ * 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:
+
2019-10-30 Zalan Bujtas <[email protected]>
ASSERTION FAILED: !object || !isRuby(object->parent()) || is<RenderRubyRun>(*object) || (object->isInline() && (object->isBeforeContent() || object->isAfterContent())) || (object->isAnonymous() && is<RenderBlock>(*object) && object->style().display() == D
Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (251808 => 251809)
--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2019-10-30 22:15:17 UTC (rev 251809)
@@ -146,7 +146,7 @@
return false;
}
-void SVGAnimateElementBase::resetAnimatedType()
+void SVGAnimateElementBase::startAnimation()
{
if (!targetElement())
return;
@@ -155,7 +155,7 @@
protectedAnimator->start(targetElement());
}
-void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount, SVGSMILElement*)
+void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount)
{
if (!targetElement())
return;
@@ -180,7 +180,7 @@
animator->apply(targetElement());
}
-void SVGAnimateElementBase::clearAnimatedType(SVGElement* targetElement)
+void SVGAnimateElementBase::stopAnimation(SVGElement* targetElement)
{
if (!targetElement)
return;
Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.h (251808 => 251809)
--- trunk/Source/WebCore/svg/SVGAnimateElementBase.h 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.h 2019-10-30 22:15:17 UTC (rev 251809)
@@ -53,10 +53,10 @@
bool calculateFromAndByValues(const String& fromString, const String& byString) override;
bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override;
- void resetAnimatedType() override;
- void calculateAnimatedValue(float progress, unsigned repeatCount, SVGSMILElement* resultElement) override;
+ void startAnimation() override;
+ void calculateAnimatedValue(float progress, unsigned repeatCount) override;
void applyResultsToTarget() override;
- void clearAnimatedType(SVGElement* targetElement) override;
+ void stopAnimation(SVGElement* targetElement) override;
Optional<float> calculateDistance(const String& fromString, const String& toString) override;
bool hasInvalidCSSAttributeType() const;
Modified: trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp (251808 => 251809)
--- trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp 2019-10-30 22:15:17 UTC (rev 251809)
@@ -139,7 +139,7 @@
updateAnimationMode();
}
-void SVGAnimateMotionElement::resetAnimatedType()
+void SVGAnimateMotionElement::startAnimation()
{
if (!hasValidAttributeType())
return;
@@ -150,7 +150,7 @@
transform->makeIdentity();
}
-void SVGAnimateMotionElement::clearAnimatedType(SVGElement* targetElement)
+void SVGAnimateMotionElement::stopAnimation(SVGElement* targetElement)
{
if (!targetElement)
return;
@@ -208,7 +208,7 @@
transform->rotate(angle);
}
-void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*)
+void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount)
{
auto targetElement = makeRefPtr(this->targetElement());
if (!targetElement)
Modified: trunk/Source/WebCore/svg/SVGAnimateMotionElement.h (251808 => 251809)
--- trunk/Source/WebCore/svg/SVGAnimateMotionElement.h 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/SVGAnimateMotionElement.h 2019-10-30 22:15:17 UTC (rev 251809)
@@ -41,12 +41,12 @@
void parseAttribute(const QualifiedName&, const AtomString&) override;
- void resetAnimatedType() override;
- void clearAnimatedType(SVGElement* targetElement) override;
+ void startAnimation() override;
+ void stopAnimation(SVGElement* targetElement) override;
bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override;
bool calculateFromAndToValues(const String& fromString, const String& toString) override;
bool calculateFromAndByValues(const String& fromString, const String& byString) override;
- void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement* resultElement) override;
+ void calculateAnimatedValue(float percentage, unsigned repeatCount) override;
void applyResultsToTarget() override;
Optional<float> calculateDistance(const String& fromString, const String& toString) override;
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (251808 => 251809)
--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2019-10-30 22:15:17 UTC (rev 251809)
@@ -562,7 +562,7 @@
m_animationValid = calcMode == CalcMode::Paced || !hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
}
-void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount, SVGSMILElement* resultElement)
+void SVGAnimationElement::updateAnimation(float percent, unsigned repeatCount)
{
if (!m_animationValid)
return;
@@ -590,7 +590,7 @@
else
effectivePercent = percent;
- calculateAnimatedValue(effectivePercent, repeatCount, resultElement);
+ calculateAnimatedValue(effectivePercent, repeatCount);
}
void SVGAnimationElement::computeCSSPropertyValue(SVGElement* element, CSSPropertyID id, String& valueString)
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.h (251808 => 251809)
--- trunk/Source/WebCore/svg/SVGAnimationElement.h 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.h 2019-10-30 22:15:17 UTC (rev 251809)
@@ -102,7 +102,7 @@
// from SVGSMILElement
void startedActiveInterval() override;
- void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) override;
+ void updateAnimation(float percent, unsigned repeat) override;
AnimatedPropertyValueType m_fromPropertyValueType { RegularPropertyValue };
AnimatedPropertyValueType m_toPropertyValueType { RegularPropertyValue };
@@ -120,7 +120,7 @@
virtual bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) = 0;
virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0;
virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0;
- virtual void calculateAnimatedValue(float percent, unsigned repeatCount, SVGSMILElement* resultElement) = 0;
+ virtual void calculateAnimatedValue(float percent, unsigned repeatCount) = 0;
virtual Optional<float> calculateDistance(const String& /*fromString*/, const String& /*toString*/) = 0;
void currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to);
Modified: trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp (251808 => 251809)
--- trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp 2019-10-30 22:15:17 UTC (rev 251809)
@@ -278,7 +278,7 @@
}
// This will calculate the contribution from the animation and add it to the resultsElement.
- if (!animation->progress(elapsed, firstAnimation.get(), seekToTime) && firstAnimation == animation)
+ if (!animation->progress(elapsed, *firstAnimation, seekToTime) && firstAnimation == animation)
firstAnimation = nullptr;
SMILTime nextFireTime = animation->nextProgressTime();
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp (251808 => 251809)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp 2019-10-30 22:15:17 UTC (rev 251809)
@@ -245,7 +245,7 @@
void SVGSMILElement::reset()
{
- clearAnimatedType(m_targetElement);
+ stopAnimation(m_targetElement);
m_activeState = Inactive;
m_isWaitingForFirstInterval = true;
@@ -610,7 +610,7 @@
// Only clear the animated type, if we had a target before.
if (m_targetElement)
- clearAnimatedType(m_targetElement);
+ stopAnimation(m_targetElement);
}
void SVGSMILElement::setTargetElement(SVGElement* target)
@@ -624,7 +624,7 @@
if (m_targetElement) {
// Clear values that may depend on the previous target.
- clearAnimatedType(m_targetElement);
+ stopAnimation(m_targetElement);
disconnectConditions();
}
@@ -1070,9 +1070,8 @@
return (m_activeState == Active && (fill() == FillFreeze || elapsed <= m_intervalBegin + repeatingDuration())) || m_activeState == Frozen;
}
-bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, bool seekToTime)
+bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement& firstAnimation, bool seekToTime)
{
- ASSERT(resultElement);
ASSERT(m_timeContainer);
ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite());
@@ -1085,9 +1084,9 @@
if (elapsed < m_intervalBegin) {
ASSERT(m_activeState != Active);
if (m_activeState == Frozen) {
- if (this == resultElement)
- resetAnimatedType();
- updateAnimation(m_lastPercent, m_lastRepeat, resultElement);
+ if (this == &firstAnimation)
+ startAnimation();
+ updateAnimation(m_lastPercent, m_lastRepeat);
}
m_nextProgressTime = m_intervalBegin;
return false;
@@ -1118,15 +1117,15 @@
m_activeState = determineActiveState(elapsed);
bool animationIsContributing = isContributing(elapsed);
- // 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.
- if (this == resultElement && animationIsContributing)
- resetAnimatedType();
+ if (animationIsContributing) {
+ // Only start the animation of the lowest priority animation that animates and contributes to a particular element/attribute pair.
+ if (this == &firstAnimation)
+ startAnimation();
- if (animationIsContributing) {
if (oldActiveState == Inactive)
startedActiveInterval();
- updateAnimation(percent, repeat, resultElement);
+ updateAnimation(percent, repeat);
m_lastPercent = percent;
m_lastRepeat = repeat;
}
@@ -1135,7 +1134,7 @@
smilEndEventSender().dispatchEventSoon(*this);
endedActiveInterval();
if (m_activeState != Frozen)
- clearAnimatedType(m_targetElement);
+ stopAnimation(m_targetElement);
} else if (oldActiveState != Active && m_activeState == Active)
smilBeginEventSender().dispatchEventSoon(*this);
Modified: trunk/Source/WebCore/svg/animation/SVGSMILElement.h (251808 => 251809)
--- trunk/Source/WebCore/svg/animation/SVGSMILElement.h 2019-10-30 21:56:56 UTC (rev 251808)
+++ trunk/Source/WebCore/svg/animation/SVGSMILElement.h 2019-10-30 22:15:17 UTC (rev 251809)
@@ -82,7 +82,7 @@
SMILTime simpleDuration() const;
void seekToIntervalCorrespondingToTime(SMILTime elapsed);
- bool progress(SMILTime elapsed, SVGSMILElement* resultsElement, bool seekToTime);
+ bool progress(SMILTime elapsed, SVGSMILElement& firstAnimation, bool seekToTime);
SMILTime nextProgressTime() const;
void reset();
@@ -98,8 +98,8 @@
void setDocumentOrderIndex(unsigned index) { m_documentOrderIndex = index; }
virtual bool isAdditive() const = 0;
- virtual void resetAnimatedType() = 0;
- virtual void clearAnimatedType(SVGElement* targetElement) = 0;
+ virtual void startAnimation() = 0;
+ virtual void stopAnimation(SVGElement* targetElement) = 0;
virtual void applyResultsToTarget() = 0;
void connectConditions();
@@ -129,7 +129,7 @@
virtual void startedActiveInterval() = 0;
void endedActiveInterval();
- virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) = 0;
+ virtual void updateAnimation(float percent, unsigned repeat) = 0;
static bool isSupportedAttribute(const QualifiedName&);
QualifiedName constructAttributeName() const;