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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp

Issue 1680183002: Move pathLength scale-factor computation to SVGPathElement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGPathElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
index 48407740dc8dbb93663ae3ecd3cc4061e9e95e1e..9915ff88fc2458482805fdbf668d2395c597feb0 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
@@ -67,24 +67,10 @@ void LayoutSVGShape::createPath()
float LayoutSVGShape::dashScaleFactor() const
{
- if (!isSVGPathElement(element()))
+ if (!isSVGPathElement(element())
+ || !styleRef().svgStyle().strokeDashArray()->size())
return 1;
- SVGPathElement& pathElement = toSVGPathElement(*element());
- if (!pathElement.pathLength()->isSpecified())
- return 1;
- const SVGComputedStyle& svgStyle = styleRef().svgStyle();
- float authorPathLength = pathElement.pathLength()->currentValue()->value();
- if (authorPathLength < 0 || !svgStyle.strokeDashArray()->size())
- return 1;
- if (!authorPathLength)
- return 0;
- // Since we know this is a <path> element, we also know the source of the
- // path - the 'd' presentation attribute. Since the StylePath already
- // caches the computed path length for use, use that here directly.
- float computedPathLength = svgStyle.d()->length();
- if (!computedPathLength)
- return 1;
- return computedPathLength / authorPathLength;
+ return toSVGPathElement(*element()).pathLengthScaleFactor();
}
void LayoutSVGShape::updateShapeFromElement()
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGPathElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698