Index: Source/core/animation/SVGStrokeDasharrayStyleInterpolation.cpp |
diff --git a/Source/core/animation/SVGStrokeDasharrayStyleInterpolation.cpp b/Source/core/animation/SVGStrokeDasharrayStyleInterpolation.cpp |
index 93353a9ce1931b119684aae81ece1849493aa609..716a643a9a16385711e0ef9dcee351683be5d1b0 100644 |
--- a/Source/core/animation/SVGStrokeDasharrayStyleInterpolation.cpp |
+++ b/Source/core/animation/SVGStrokeDasharrayStyleInterpolation.cpp |
@@ -5,7 +5,7 @@ |
#include "config.h" |
#include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" |
-#include "core/animation/SVGLengthStyleInterpolation.h" |
+#include "core/animation/LengthStyleInterpolation.h" |
#include "core/css/CSSValueList.h" |
#include "core/css/resolver/StyleBuilder.h" |
@@ -25,15 +25,13 @@ bool isNone(const CSSValue& value) |
} // namespace |
-PassRefPtrWillBeRawPtr<CSSValueList> SVGStrokeDasharrayStyleInterpolation::interpolableValueToStrokeDasharray(const InterpolableValue& interpolableValue, const Vector<CSSPrimitiveValue::UnitType>& types) |
+PassRefPtrWillBeRawPtr<CSSValueList> SVGStrokeDasharrayStyleInterpolation::interpolableValueToStrokeDasharray(const InterpolableValue& interpolableValue) |
{ |
const InterpolableList& interpolableList = toInterpolableList(interpolableValue); |
- ASSERT(types.size() == interpolableList.length()); |
RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated(); |
- for (size_t index = 0; index < interpolableList.length(); ++index) { |
- ret->append(SVGLengthStyleInterpolation::interpolableValueToLength(*interpolableList.get(index), types.at(index), RangeNonNegative)); |
- } |
+ for (size_t index = 0; index < interpolableList.length(); ++index) |
+ ret->append(LengthStyleInterpolation::fromInterpolableValue(*interpolableList.get(index), RangeNonNegative)); |
return ret.release(); |
} |
@@ -44,7 +42,7 @@ bool SVGStrokeDasharrayStyleInterpolation::canCreateFrom(const CSSValue& value) |
const CSSValueList& valueList = toCSSValueList(value); |
for (size_t index = 0; index < valueList.length(); ++index) { |
- if (!SVGLengthStyleInterpolation::canCreateFrom(*valueList.item(index))) |
+ if (!LengthStyleInterpolation::canCreateFrom(*valueList.item(index))) |
return false; |
} |
return true; |
@@ -63,7 +61,6 @@ PassRefPtrWillBeRawPtr<SVGStrokeDasharrayStyleInterpolation> SVGStrokeDasharrayS |
size_t size = lowestCommonMultiple(valueListStart.length(), valueListEnd.length()); |
ASSERT(size > 0); |
- Vector<CSSPrimitiveValue::UnitType> types(size); |
OwnPtrWillBeRawPtr<InterpolableList> interpolableStart = InterpolableList::create(size); |
OwnPtrWillBeRawPtr<InterpolableList> interpolableEnd = InterpolableList::create(size); |
@@ -71,19 +68,15 @@ PassRefPtrWillBeRawPtr<SVGStrokeDasharrayStyleInterpolation> SVGStrokeDasharrayS |
const CSSPrimitiveValue& from = *toCSSPrimitiveValue(valueListStart.item(i % valueListStart.length())); |
const CSSPrimitiveValue& to = *toCSSPrimitiveValue(valueListEnd.item(i % valueListEnd.length())); |
- // Spec: If a pair of values cannot be interpolated, then the lists are not interpolable. |
- types[i] = SVGLengthStyleInterpolation::commonUnitType(from, to); |
- if (types[i] == CSSPrimitiveValue::CSS_UNKNOWN) |
- return nullptr; |
- interpolableStart->set(i, SVGLengthStyleInterpolation::lengthToInterpolableValue(from)); |
- interpolableEnd->set(i, SVGLengthStyleInterpolation::lengthToInterpolableValue(to)); |
+ interpolableStart->set(i, LengthStyleInterpolation::toInterpolableValue(from)); |
+ interpolableEnd->set(i, LengthStyleInterpolation::toInterpolableValue(to)); |
} |
- return adoptRefWillBeNoop(new SVGStrokeDasharrayStyleInterpolation(interpolableStart.release(), interpolableEnd.release(), id, types)); |
+ return adoptRefWillBeNoop(new SVGStrokeDasharrayStyleInterpolation(interpolableStart.release(), interpolableEnd.release(), id)); |
} |
void SVGStrokeDasharrayStyleInterpolation::apply(StyleResolverState& state) const |
{ |
- StyleBuilder::applyProperty(m_id, state, interpolableValueToStrokeDasharray(*m_cachedValue, m_types).get()); |
+ StyleBuilder::applyProperty(m_id, state, interpolableValueToStrokeDasharray(*m_cachedValue).get()); |
} |
} |