Diff
Modified: trunk/Source/WebCore/ChangeLog (242969 => 242970)
--- trunk/Source/WebCore/ChangeLog 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/ChangeLog 2019-03-14 22:11:42 UTC (rev 242970)
@@ -1,3 +1,66 @@
+2019-03-14 Said Abou-Hallawa <sabouhall...@apple.com>
+
+ Use enum class for AnimationMode
+ https://bugs.webkit.org/show_bug.cgi?id=195762
+
+ Reviewed by Tim Horton.
+
+ Convert AnimationMode into an enum class.
+
+ * svg/SVGAnimateElementBase.cpp:
+ (WebCore::SVGAnimateElementBase::calculateFromAndByValues):
+ (WebCore::SVGAnimateElementBase::isAdditive const):
+ * svg/SVGAnimateMotionElement.cpp:
+ (WebCore::SVGAnimateMotionElement::calculateFromAndByValues):
+ (WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
+ (WebCore::SVGAnimateMotionElement::updateAnimationMode):
+ * svg/SVGAnimatedAngle.cpp:
+ (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedBoolean.cpp:
+ (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedColor.cpp:
+ (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedEnumeration.cpp:
+ (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedInteger.cpp:
+ (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedIntegerOptionalInteger.cpp:
+ (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedLength.cpp:
+ (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedLengthList.cpp:
+ (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedNumber.cpp:
+ (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedNumberList.cpp:
+ (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedNumberOptionalNumber.cpp:
+ (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedPath.cpp:
+ (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedPointList.cpp:
+ (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedPreserveAspectRatio.cpp:
+ (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedRect.cpp:
+ (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
+ * svg/SVGAnimatedTransformList.cpp:
+ (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
+ * svg/SVGAnimationElement.cpp:
+ (WebCore::SVGAnimationElement::updateAnimationMode):
+ (WebCore::SVGAnimationElement::isAdditive const):
+ (WebCore::SVGAnimationElement::isAccumulated const):
+ (WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced):
+ (WebCore::SVGAnimationElement::startedActiveInterval):
+ (WebCore::SVGAnimationElement::updateAnimation):
+ * svg/SVGAnimationElement.h:
+ (WebCore::SVGAnimationElement::adjustFromToListValues):
+ (WebCore::SVGAnimationElement::animateDiscreteType):
+ (WebCore::SVGAnimationElement::animateAdditiveNumber):
+ * svg/SVGSetElement.cpp:
+ (WebCore::SVGSetElement::SVGSetElement):
+ (WebCore::SVGSetElement::updateAnimationMode):
+
2019-03-14 Ryosuke Niwa <rn...@webkit.org>
Storing a Node in Ref/RefPtr inside its destructor results in double delete
Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -163,11 +163,11 @@
if (!this->targetElement())
return false;
- if (animationMode() == ByAnimation && !isAdditive())
+ if (animationMode() == AnimationMode::By && !isAdditive())
return false;
// from-by animation may only be used with attributes that support addition (e.g. most numeric attributes).
- if (animationMode() == FromByAnimation && !animatedPropertyTypeSupportsAddition())
+ if (animationMode() == AnimationMode::FromBy && !animatedPropertyTypeSupportsAddition())
return false;
ASSERT(!hasTagName(SVGNames::setTag));
@@ -412,7 +412,7 @@
bool SVGAnimateElementBase::isAdditive() const
{
- if (animationMode() == ByAnimation || animationMode() == FromByAnimation) {
+ if (animationMode() == AnimationMode::By || animationMode() == AnimationMode::FromBy) {
if (!animatedPropertyTypeSupportsAddition())
return false;
}
Modified: trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -176,7 +176,7 @@
bool SVGAnimateMotionElement::calculateFromAndByValues(const String& fromString, const String& byString)
{
m_hasToPointAtEndOfDuration = false;
- if (animationMode() == ByAnimation && !isAdditive())
+ if (animationMode() == AnimationMode::By && !isAdditive())
return false;
parsePoint(fromString, m_fromPoint);
FloatPoint byPoint;
@@ -222,7 +222,7 @@
if (!isAdditive())
transform->makeIdentity();
- if (animationMode() != PathAnimation) {
+ if (animationMode() != AnimationMode::Path) {
FloatPoint toPointAtEndOfDuration = m_toPoint;
if (isAccumulated() && repeatCount && m_hasToPointAtEndOfDuration)
toPointAtEndOfDuration = m_toPointAtEndOfDuration;
@@ -288,7 +288,7 @@
void SVGAnimateMotionElement::updateAnimationMode()
{
if (!m_animationPath.isEmpty())
- setAnimationMode(PathAnimation);
+ setAnimationMode(AnimationMode::Path);
else
SVGAnimationElement::updateAnimationMode();
}
Modified: trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -80,7 +80,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto& fromAngleAndEnumeration = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<std::pair<SVGAngleValue, unsigned>>();
+ const auto& fromAngleAndEnumeration = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<std::pair<SVGAngleValue, unsigned>>();
auto& toAngleAndEnumeration = to->as<std::pair<SVGAngleValue, unsigned>>();
auto& toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->as<std::pair<SVGAngleValue, unsigned>>();
auto& animatedAngleAndEnumeration = animated->as<std::pair<SVGAngleValue, unsigned>>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -70,7 +70,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto fromBoolean = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<bool>();
+ const auto fromBoolean = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<bool>();
const auto toBoolean = to->as<bool>();
auto& animatedBoolean = animated->as<bool>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedColor.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedColor.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedColor.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -70,7 +70,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- auto fromColor = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<Color>();
+ auto fromColor = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<Color>();
auto toColor = to->as<Color>();
// Apply CSS inheritance rules.
Modified: trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -148,7 +148,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto fromEnumeration = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<unsigned>();
+ const auto fromEnumeration = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<unsigned>();
const auto toEnumeration = to->as<unsigned>();
auto& animatedEnumeration = animated->as<unsigned>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -82,7 +82,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto fromInteger = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<int>();
+ const auto fromInteger = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<int>();
const auto toInteger = to->as<int>();
const auto toAtEndOfDurationInteger = toAtEndOfDuration->as<int>();
auto& animatedInteger = animated->as<int>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -78,7 +78,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto& fromIntegerPair = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<std::pair<int, int>>();
+ const auto& fromIntegerPair = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<std::pair<int, int>>();
const auto& toIntegerPair = to->as<std::pair<int, int>>();
const auto& toAtEndOfDurationIntegerPair = toAtEndOfDuration->as<std::pair<int, int>>();
auto& animatedIntegerPair = animated->as<std::pair<int, int>>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedLength.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedLength.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedLength.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -86,7 +86,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- auto fromSVGLength = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<SVGLengthValue>();
+ auto fromSVGLength = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGLengthValue>();
auto toSVGLength = to->as<SVGLengthValue>();
const auto& toAtEndOfDurationSVGLength = toAtEndOfDuration->as<SVGLengthValue>();
auto& animatedSVGLength = animated->as<SVGLengthValue>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -90,7 +90,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- auto fromLengthList = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<SVGLengthListValues>();
+ auto fromLengthList = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGLengthListValues>();
auto toLengthList = to->as<SVGLengthListValues>();
const auto& toAtEndOfDurationLengthList = toAtEndOfDuration->as<SVGLengthListValues>();
auto& animatedLengthList = animated->as<SVGLengthListValues>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -79,7 +79,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- auto fromNumber = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<float>();
+ auto fromNumber = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<float>();
auto toNumber = to->as<float>();
const auto toAtEndOfDurationNumber = toAtEndOfDuration->as<float>();
auto& animatedNumber = animated->as<float>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -81,7 +81,7 @@
{
ASSERT(m_animationElement);
- const auto& fromNumberList = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<SVGNumberListValues>();
+ const auto& fromNumberList = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGNumberListValues>();
const auto& toNumberList = to->as<SVGNumberListValues>();
const auto& toAtEndOfDurationNumberList = toAtEndOfDuration->as<SVGNumberListValues>();
auto& animatedNumberList = animated->as<SVGNumberListValues>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -78,7 +78,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto& fromNumberPair = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<std::pair<float, float>>();
+ const auto& fromNumberPair = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<std::pair<float, float>>();
const auto& toNumberPair = to->as<std::pair<float, float>>();
const auto& toAtEndOfDurationNumberPair = toAtEndOfDuration->as<std::pair<float, float>>();
auto& animatedNumberPair = animated->as<std::pair<float, float>>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedPath.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedPath.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedPath.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -108,7 +108,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- bool isToAnimation = m_animationElement->animationMode() == ToAnimation;
+ bool isToAnimation = m_animationElement->animationMode() == AnimationMode::To;
auto& animatedPath = animated->as<SVGPathByteStream>();
SVGPathByteStream underlyingPath;
Modified: trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -82,7 +82,7 @@
{
ASSERT(m_animationElement);
- const auto& fromPointList = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<SVGPointListValues>();
+ const auto& fromPointList = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGPointListValues>();
const auto& toPointList = to->as<SVGPointListValues>();
const auto& toAtEndOfDurationPointList = toAtEndOfDuration->as<SVGPointListValues>();
auto& animatedPointList = animated->as<SVGPointListValues>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -69,7 +69,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto& fromPreserveAspectRatio = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<SVGPreserveAspectRatioValue>();
+ const auto& fromPreserveAspectRatio = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<SVGPreserveAspectRatioValue>();
const auto& toPreserveAspectRatio = to->as<SVGPreserveAspectRatioValue>();
auto& animatedPreserveAspectRatio = animated->as<SVGPreserveAspectRatioValue>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedRect.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedRect.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -73,7 +73,7 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const auto& fromRect = (m_animationElement->animationMode() == ToAnimation ? animated : from)->as<FloatRect>();
+ const auto& fromRect = (m_animationElement->animationMode() == AnimationMode::To ? animated : from)->as<FloatRect>();
const auto& toRect = to->as<FloatRect>();
const auto& toAtEndOfDurationRect = toAtEndOfDuration->as<FloatRect>();
auto& animatedRect = animated->as<FloatRect>();
Modified: trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -105,7 +105,7 @@
return;
// Never resize the animatedTransformList to the toTransformList size, instead either clear the list or append to it.
- if (!animatedTransformList.isEmpty() && (!m_animationElement->isAdditive() || m_animationElement->animationMode() == ToAnimation))
+ if (!animatedTransformList.isEmpty() && (!m_animationElement->isAdditive() || m_animationElement->animationMode() == AnimationMode::To))
animatedTransformList.clear();
auto fromTransformListSize = fromTransformList.size();
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -268,13 +268,13 @@
{
// http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
if (hasAttribute(SVGNames::valuesAttr))
- setAnimationMode(ValuesAnimation);
+ setAnimationMode(AnimationMode::Values);
else if (!toValue().isEmpty())
- setAnimationMode(fromValue().isEmpty() ? ToAnimation : FromToAnimation);
+ setAnimationMode(fromValue().isEmpty() ? AnimationMode::To : AnimationMode::FromTo);
else if (!byValue().isEmpty())
- setAnimationMode(fromValue().isEmpty() ? ByAnimation : FromByAnimation);
+ setAnimationMode(fromValue().isEmpty() ? AnimationMode::By : AnimationMode::FromBy);
else
- setAnimationMode(NoAnimation);
+ setAnimationMode(AnimationMode::None);
}
void SVGAnimationElement::setCalcMode(const AtomicString& calcMode)
@@ -327,7 +327,7 @@
{
static NeverDestroyed<const AtomicString> sum("sum", AtomicString::ConstructFromLiteral);
const AtomicString& value = attributeWithoutSynchronization(SVGNames::additiveAttr);
- return value == sum || animationMode() == ByAnimation;
+ return value == sum || animationMode() == AnimationMode::By;
}
bool SVGAnimationElement::isAccumulated() const
@@ -334,7 +334,7 @@
{
static NeverDestroyed<const AtomicString> sum("sum", AtomicString::ConstructFromLiteral);
const AtomicString& value = attributeWithoutSynchronization(SVGNames::accumulateAttr);
- return value == sum && animationMode() != ToAnimation;
+ return value == sum && animationMode() != AnimationMode::To;
}
bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement* element, const QualifiedName& attributeName)
@@ -369,7 +369,7 @@
void SVGAnimationElement::calculateKeyTimesForCalcModePaced()
{
ASSERT(calcMode() == CalcMode::Paced);
- ASSERT(animationMode() == ValuesAnimation);
+ ASSERT(animationMode() == AnimationMode::Values);
unsigned valuesCount = m_values.size();
ASSERT(valuesCount >= 1);
@@ -554,7 +554,7 @@
unsigned splinesCount = m_keySplines.size();
if (!splinesCount
|| (hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) && m_keyPoints.size() - 1 != splinesCount)
- || (animationMode == ValuesAnimation && m_values.size() - 1 != splinesCount)
+ || (animationMode == AnimationMode::Values && m_values.size() - 1 != splinesCount)
|| (hasAttributeWithoutSynchronization(SVGNames::keyTimesAttr) && m_keyTimes.size() - 1 != splinesCount))
return;
}
@@ -562,22 +562,22 @@
String from = fromValue();
String to = toValue();
String by = byValue();
- if (animationMode == NoAnimation)
+ if (animationMode == AnimationMode::None)
return;
- if ((animationMode == FromToAnimation || animationMode == FromByAnimation || animationMode == ToAnimation || animationMode == ByAnimation)
+ if ((animationMode == AnimationMode::FromTo || animationMode == AnimationMode::FromBy || animationMode == AnimationMode::To || animationMode == AnimationMode::By)
&& (hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) && hasAttributeWithoutSynchronization(SVGNames::keyTimesAttr) && (m_keyTimes.size() < 2 || m_keyTimes.size() != m_keyPoints.size())))
return;
- if (animationMode == FromToAnimation)
+ if (animationMode == AnimationMode::FromTo)
m_animationValid = calculateFromAndToValues(from, to);
- else if (animationMode == ToAnimation) {
+ else if (animationMode == AnimationMode::To) {
// For to-animations the from value is the current accumulated value from lower priority animations.
// The value is not static and is determined during the animation.
m_animationValid = calculateFromAndToValues(emptyString(), to);
- } else if (animationMode == FromByAnimation)
+ } else if (animationMode == AnimationMode::FromBy)
m_animationValid = calculateFromAndByValues(from, by);
- else if (animationMode == ByAnimation)
+ else if (animationMode == AnimationMode::By)
m_animationValid = calculateFromAndByValues(emptyString(), by);
- else if (animationMode == ValuesAnimation) {
+ else if (animationMode == AnimationMode::Values) {
m_animationValid = m_values.size() >= 1
&& (calcMode == CalcMode::Paced || !hasAttributeWithoutSynchronization(SVGNames::keyTimesAttr) || hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
&& (calcMode == CalcMode::Discrete || !m_keyTimes.size() || m_keyTimes.last() == 1)
@@ -587,7 +587,7 @@
m_animationValid = calculateToAtEndOfDurationValue(m_values.last());
if (calcMode == CalcMode::Paced && m_animationValid)
calculateKeyTimesForCalcModePaced();
- } else if (animationMode == PathAnimation)
+ } else if (animationMode == AnimationMode::Path)
m_animationValid = calcMode == CalcMode::Paced || !hasAttributeWithoutSynchronization(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
}
@@ -599,7 +599,7 @@
float effectivePercent;
CalcMode calcMode = this->calcMode();
AnimationMode animationMode = this->animationMode();
- if (animationMode == ValuesAnimation) {
+ if (animationMode == AnimationMode::Values) {
String from;
String to;
currentValuesForValuesAnimation(percent, effectivePercent, from, to);
@@ -614,7 +614,7 @@
effectivePercent = calculatePercentFromKeyPoints(percent);
else if (m_keyPoints.isEmpty() && calcMode == CalcMode::Spline && m_keyTimes.size() > 1)
effectivePercent = calculatePercentForSpline(percent, calculateKeyTimesIndex(percent));
- else if (animationMode == FromToAnimation || animationMode == ToAnimation)
+ else if (animationMode == AnimationMode::FromTo || animationMode == AnimationMode::To)
effectivePercent = calculatePercentForFromTo(percent);
else
effectivePercent = percent;
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.h (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGAnimationElement.h 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.h 2019-03-14 22:11:42 UTC (rev 242970)
@@ -36,14 +36,14 @@
class SVGAnimatedType;
class TimeContainer;
-enum AnimationMode {
- NoAnimation,
- FromToAnimation,
- FromByAnimation,
- ToAnimation,
- ByAnimation,
- ValuesAnimation,
- PathAnimation // Used by AnimateMotion.
+enum class AnimationMode : uint8_t {
+ None,
+ FromTo,
+ FromBy,
+ To,
+ By,
+ Values,
+ Path // Used by AnimateMotion.
};
// If we have 'currentColor' or 'inherit' as animation value, we need to grab
@@ -50,7 +50,7 @@
// the value during the animation since the value can be animated itself.
enum AnimatedPropertyValueType { RegularPropertyValue, CurrentColorValue, InheritValue };
-enum class CalcMode { Discrete, Linear, Paced, Spline };
+enum class CalcMode : uint8_t { Discrete, Linear, Paced, Spline };
class SVGAnimationElement : public SVGSMILElement, public SVGExternalResourcesRequired, public SVGTests {
WTF_MAKE_ISO_ALLOCATED(SVGAnimationElement);
@@ -105,7 +105,7 @@
unsigned fromListSize = fromList.size();
if (fromListSize != toListSize && fromListSize) {
if (percentage < 0.5) {
- if (animationMode() != ToAnimation)
+ if (animationMode() != AnimationMode::To)
animatedList = AnimatedType(fromList);
} else
animatedList = AnimatedType(toList);
@@ -122,7 +122,7 @@
template<typename AnimatedType> void animateDiscreteType(float percentage, const AnimatedType& fromType, const AnimatedType& toType, AnimatedType& animatedType)
{
- if ((animationMode() == FromToAnimation && percentage > 0.5) || animationMode() == ToAnimation || percentage == 1) {
+ if ((animationMode() == AnimationMode::FromTo && percentage > 0.5) || animationMode() == AnimationMode::To || percentage == 1) {
animatedType = AnimatedType(toType);
return;
}
@@ -140,7 +140,7 @@
if (isAccumulated() && repeatCount)
number += toAtEndOfDurationNumber * repeatCount;
- if (isAdditive() && animationMode() != ToAnimation)
+ if (isAdditive() && animationMode() != AnimationMode::To)
animatedNumber += number;
else
animatedNumber = number;
@@ -220,7 +220,7 @@
String m_lastValuesAnimationTo;
bool m_hasInvalidCSSAttributeType { false };
CalcMode m_calcMode { CalcMode::Linear };
- AnimationMode m_animationMode { NoAnimation };
+ AnimationMode m_animationMode { AnimationMode::None };
AttributeOwnerProxy m_attributeOwnerProxy { *this };
};
Modified: trunk/Source/WebCore/svg/SVGSetElement.cpp (242969 => 242970)
--- trunk/Source/WebCore/svg/SVGSetElement.cpp 2019-03-14 22:08:53 UTC (rev 242969)
+++ trunk/Source/WebCore/svg/SVGSetElement.cpp 2019-03-14 22:11:42 UTC (rev 242970)
@@ -31,7 +31,7 @@
inline SVGSetElement::SVGSetElement(const QualifiedName& tagName, Document& document)
: SVGAnimateElementBase(tagName, document)
{
- setAnimationMode(ToAnimation);
+ setAnimationMode(AnimationMode::To);
ASSERT(hasTagName(SVGNames::setTag));
}
@@ -42,7 +42,7 @@
void SVGSetElement::updateAnimationMode()
{
- // No-op, as <set> has a constant animation mode of ToAnimation.
+ // No-op, as <set> has a constant animation mode of AnimationMode::To.
// See: http://www.w3.org/TR/SVG/single-page.html#animate-SetElement
}