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

Unified Diff: Source/core/rendering/svg/SVGRenderSupport.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/rendering/svg/SVGRenderSupport.cpp
diff --git a/Source/core/rendering/svg/SVGRenderSupport.cpp b/Source/core/rendering/svg/SVGRenderSupport.cpp
index cfc4a641f7f647a07a4c9f39b7c614919bd3e486..262e8b145da4f95725b72ed1cf95661cc52f57eb 100644
--- a/Source/core/rendering/svg/SVGRenderSupport.cpp
+++ b/Source/core/rendering/svg/SVGRenderSupport.cpp
@@ -357,21 +357,21 @@ void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const
ASSERT(svgStyle);
SVGLengthContext lengthContext(toSVGElement(object->node()));
- context->setStrokeThickness(svgStyle->strokeWidth().value(lengthContext));
+ context->setStrokeThickness(svgStyle->strokeWidth()->value(lengthContext));
context->setLineCap(svgStyle->capStyle());
context->setLineJoin(svgStyle->joinStyle());
context->setMiterLimit(svgStyle->strokeMiterLimit());
- const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();
- if (dashes.isEmpty())
+ RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray();
+ if (dashes->isEmpty())
return;
DashArray dashArray;
- const Vector<SVGLength>::const_iterator end = dashes.end();
- for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
- dashArray.append((*it).value(lengthContext));
+ size_t length = dashes->numberOfItems();
pdr. 2014/01/07 06:42:53 This may introduce a perf regression due to bounds
kouhei (in TOK) 2014/01/08 08:12:07 Done. Added NewSVGListPropertyHelper<>::ConstItera
+ for (size_t i = 0; i < length; ++i)
+ dashArray.append(dashes->at(i)->value(lengthContext));
- context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengthContext));
+ context->setLineDash(dashArray, svgStyle->strokeDashOffset()->value(lengthContext));
}
void SVGRenderSupport::applyStrokeStyleToStrokeData(StrokeData* strokeData, const RenderStyle* style, const RenderObject* object)
@@ -386,21 +386,21 @@ void SVGRenderSupport::applyStrokeStyleToStrokeData(StrokeData* strokeData, cons
ASSERT(svgStyle);
SVGLengthContext lengthContext(toSVGElement(object->node()));
- strokeData->setThickness(svgStyle->strokeWidth().value(lengthContext));
+ strokeData->setThickness(svgStyle->strokeWidth()->value(lengthContext));
strokeData->setLineCap(svgStyle->capStyle());
strokeData->setLineJoin(svgStyle->joinStyle());
strokeData->setMiterLimit(svgStyle->strokeMiterLimit());
- const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();
- if (dashes.isEmpty())
+ RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray();
+ if (dashes->isEmpty())
return;
DashArray dashArray;
- const Vector<SVGLength>::const_iterator end = dashes.end();
- for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
- dashArray.append((*it).value(lengthContext));
+ size_t length = dashes->numberOfItems();
+ for (size_t i = 0; i < length; ++i)
+ dashArray.append(dashes->at(i)->value(lengthContext));
- strokeData->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengthContext));
+ strokeData->setLineDash(dashArray, svgStyle->strokeDashOffset()->value(lengthContext));
}
bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object)

Powered by Google App Engine
This is Rietveld 408576698