Index: Source/core/layout/svg/SVGLayoutSupport.cpp |
diff --git a/Source/core/layout/svg/SVGLayoutSupport.cpp b/Source/core/layout/svg/SVGLayoutSupport.cpp |
index bd23d623207fc8da4fa8770a062ed7f5a95d49d0..c9c11fe84f29394d932724f66df6fbc5f39f4a52 100644 |
--- a/Source/core/layout/svg/SVGLayoutSupport.cpp |
+++ b/Source/core/layout/svg/SVGLayoutSupport.cpp |
@@ -348,6 +348,14 @@ bool SVGLayoutSupport::transformToUserSpaceAndCheckClipping(LayoutObject* object |
return pointInClippingArea(object, localPoint); |
} |
+DashArray SVGLayoutSupport::resolveSVGDashArray(const SVGDashArray& svgDashArray, const LayoutStyle& style, const SVGLengthContext& lengthContext) |
+{ |
+ DashArray dashArray; |
+ for (const Length& dashLength : svgDashArray.vector()) |
+ dashArray.append(lengthContext.valueForLength(dashLength, style)); |
+ return dashArray; |
+} |
+ |
void SVGLayoutSupport::applyStrokeStyleToContext(GraphicsContext& context, const LayoutStyle& style, const LayoutObject& object) |
{ |
ASSERT(object.node()); |
@@ -361,14 +369,7 @@ void SVGLayoutSupport::applyStrokeStyleToContext(GraphicsContext& context, const |
context.setLineJoin(svgStyle.joinStyle()); |
context.setMiterLimit(svgStyle.strokeMiterLimit()); |
- RefPtrWillBeRawPtr<SVGLengthList> dashes = svgStyle.strokeDashArray(); |
- DashArray dashArray; |
- if (!dashes->isEmpty()) { |
- SVGLengthList::ConstIterator it = dashes->begin(); |
- SVGLengthList::ConstIterator itEnd = dashes->end(); |
- for (; it != itEnd; ++it) |
- dashArray.append(it->value(lengthContext)); |
- } |
+ DashArray dashArray = resolveSVGDashArray(*svgStyle.strokeDashArray(), style, lengthContext); |
pdr.
2015/03/05 21:35:59
Can we save an unnecessary copy by using a const r
fs
2015/03/06 11:27:46
There's no unnecessary copy here - for the instanc
|
context.setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeDashOffset(), style)); |
} |
@@ -385,14 +386,7 @@ void SVGLayoutSupport::applyStrokeStyleToStrokeData(StrokeData& strokeData, cons |
strokeData.setLineJoin(svgStyle.joinStyle()); |
strokeData.setMiterLimit(svgStyle.strokeMiterLimit()); |
- RefPtrWillBeRawPtr<SVGLengthList> dashes = svgStyle.strokeDashArray(); |
- DashArray dashArray; |
- if (!dashes->isEmpty()) { |
- SVGLengthList::ConstIterator it = dashes->begin(); |
- SVGLengthList::ConstIterator itEnd = dashes->end(); |
- for (; it != itEnd; ++it) |
- dashArray.append(it->value(lengthContext)); |
- } |
+ DashArray dashArray = resolveSVGDashArray(*svgStyle.strokeDashArray(), style, lengthContext); |
strokeData.setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeDashOffset(), style)); |
} |