Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/WebKit/Source/core/animation/LengthSVGInterpolation.cpp

Issue 1491023003: Refactor SVGAnimatedLength negative values mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace SVGLengthNegativeValuesMode enum with bool Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/LengthSVGInterpolation.cpp
diff --git a/third_party/WebKit/Source/core/animation/LengthSVGInterpolation.cpp b/third_party/WebKit/Source/core/animation/LengthSVGInterpolation.cpp
index eb8994168011140c7625e1e1af8ba8d5d8b0fc9a..4245f0e9cfe5ea9100c9976c4a16df8012158ac5 100644
--- a/third_party/WebKit/Source/core/animation/LengthSVGInterpolation.cpp
+++ b/third_party/WebKit/Source/core/animation/LengthSVGInterpolation.cpp
@@ -37,13 +37,11 @@ void populateModeData(const SVGAnimatedPropertyBase* attribute, LengthSVGInterpo
case AnimatedLength: {
const SVGAnimatedLength& animatedLength = static_cast<const SVGAnimatedLength&>(*attribute);
ptrModeData->unitMode = animatedLength.currentValue()->unitMode();
- ptrModeData->negativeValuesMode = animatedLength.negativeValuesMode();
break;
}
case AnimatedLengthList: {
const SVGAnimatedLengthList& animatedLengthList = static_cast<const SVGAnimatedLengthList&>(*attribute);
ptrModeData->unitMode = animatedLengthList.currentValue()->unitMode();
- ptrModeData->negativeValuesMode = AllowNegativeLengths;
break;
}
default:
@@ -129,7 +127,7 @@ PassOwnPtr<InterpolableValue> LengthSVGInterpolation::toInterpolableValue(SVGLen
return listOfValues.release();
}
-PassRefPtrWillBeRawPtr<SVGLength> LengthSVGInterpolation::fromInterpolableValue(const InterpolableValue& interpolableValue, const NonInterpolableType& modeData, const SVGElement* element)
+PassRefPtrWillBeRawPtr<SVGLength> LengthSVGInterpolation::fromInterpolableValue(const InterpolableValue& interpolableValue, const NonInterpolableType& modeData, const SVGElement* element, const QualifiedName& attributeName)
{
const InterpolableList& listOfValues = toInterpolableList(interpolableValue);
ASSERT(element);
@@ -163,7 +161,7 @@ PassRefPtrWillBeRawPtr<SVGLength> LengthSVGInterpolation::fromInterpolableValue(
}
}
- if (modeData.negativeValuesMode == ForbidNegativeLengths && value < 0)
+ if (SVGLength::negativeValuesForbiddenForAnimatedLengthAttribute(attributeName) && value < 0)
value = 0;
RefPtrWillBeRawPtr<SVGLength> result = SVGLength::create(modeData.unitMode); // defaults to the length 0
@@ -173,7 +171,7 @@ PassRefPtrWillBeRawPtr<SVGLength> LengthSVGInterpolation::fromInterpolableValue(
PassRefPtrWillBeRawPtr<SVGPropertyBase> LengthSVGInterpolation::interpolatedValue(SVGElement& targetElement) const
{
- return fromInterpolableValue(*m_cachedValue, m_modeData, &targetElement);
+ return fromInterpolableValue(*m_cachedValue, m_modeData, &targetElement, attributeName());
}
}

Powered by Google App Engine
This is Rietveld 408576698