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

Unified Diff: Source/core/frame/animation/CSSPropertyAnimation.cpp

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 7 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: Source/core/frame/animation/CSSPropertyAnimation.cpp
diff --git a/Source/core/frame/animation/CSSPropertyAnimation.cpp b/Source/core/frame/animation/CSSPropertyAnimation.cpp
index 7823da847f7b8cf9715a67162358541341f22878..e30ca5155097705c64ba0d6355df2ea224fab863 100644
--- a/Source/core/frame/animation/CSSPropertyAnimation.cpp
+++ b/Source/core/frame/animation/CSSPropertyAnimation.cpp
@@ -197,19 +197,19 @@ static inline LengthBox blendFunc(const AnimationBase* anim, const LengthBox& fr
return result;
}
-static inline SVGLength blendFunc(const AnimationBase*, const SVGLength& from, const SVGLength& to, double progress)
+static inline PassRefPtr<SVGLength> blendFunc(const AnimationBase*, SVGLength* from, SVGLength* to, double progress)
{
- return to.blend(from, narrowPrecisionToFloat(progress));
+ return to->blend(from, narrowPrecisionToFloat(progress));
}
-static inline Vector<SVGLength> blendFunc(const AnimationBase*, const Vector<SVGLength>& from, const Vector<SVGLength>& to, double progress)
+static inline PassRefPtr<SVGLengthList> blendFunc(const AnimationBase*, SVGLengthList* from, SVGLengthList* to, double progress)
{
- size_t fromLength = from.size();
- size_t toLength = to.size();
+ size_t fromLength = from->numberOfItems();
+ size_t toLength = to->numberOfItems();
if (!fromLength)
- return !progress ? from : to;
+ return !progress ? from->clone() : to->clone();
if (!toLength)
- return progress == 1 ? from : to;
+ return progress == 1 ? from->clone() : to->clone();
size_t resultLength = fromLength;
if (fromLength != toLength) {
@@ -220,9 +220,9 @@ static inline Vector<SVGLength> blendFunc(const AnimationBase*, const Vector<SVG
else
resultLength = fromLength * toLength;
}
- Vector<SVGLength> result(resultLength);
+ RefPtr<SVGLengthList> result;
for (size_t i = 0; i < resultLength; ++i)
- result[i] = to[i % toLength].blend(from[i % fromLength], narrowPrecisionToFloat(progress));
+ result->append(to->at(i % toLength)->blend(from->at(i % fromLength), narrowPrecisionToFloat(progress)));
return result;
}
@@ -1064,9 +1064,9 @@ void CSSPropertyAnimation::ensurePropertyMap()
gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &RenderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStrokePaintColor));
gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacity, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity));
- gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth));
- gPropertyWrappers->append(new PropertyWrapper< Vector<SVGLength> >(CSSPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArray));
- gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset));
+ gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSPropertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth));
+ gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLengthList>(CSSPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArray));
+ gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSPropertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset));
gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterlimit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit));
gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity, &RenderStyle::floodOpacity, &RenderStyle::setFloodOpacity));
@@ -1077,8 +1077,8 @@ void CSSPropertyAnimation::ensurePropertyMap()
gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyLightingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor));
- gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShiftValue));
- gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning));
+ gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSPropertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShiftValue));
+ gPropertyWrappers->append(new RefCountedPropertyWrapper<SVGLength>(CSSPropertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning));
if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexGrow, &RenderStyle::flexGrow, &RenderStyle::setFlexGrow));

Powered by Google App Engine
This is Rietveld 408576698