Index: third_party/WebKit/Source/core/svg/SVGPathElement.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGPathElement.cpp b/third_party/WebKit/Source/core/svg/SVGPathElement.cpp |
index 5cd714a5d5b4bd2f451a88ae857dfacac7992fcb..2833019000ec367ba6f9a313be3c9cf7006b5617 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGPathElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGPathElement.cpp |
@@ -68,14 +68,31 @@ DEFINE_TRACE(SVGPathElement) |
DEFINE_NODE_FACTORY(SVGPathElement) |
-Path SVGPathElement::asPath() const |
+const StylePath* SVGPathElement::stylePath() const |
{ |
- if (layoutObject()) { |
- const SVGComputedStyle& svgStyle = layoutObject()->styleRef().svgStyle(); |
- return svgStyle.d()->path(); |
- } |
+ if (LayoutObject* layoutObject = this->layoutObject()) |
+ return layoutObject->styleRef().svgStyle().d(); |
+ return m_path->currentValue()->pathValue()->cachedPath(); |
+} |
- return m_path->currentValue()->pathValue()->cachedPath()->path(); |
+float SVGPathElement::pathLengthScaleFactor() const |
+{ |
+ if (!pathLength()->isSpecified()) |
+ return 1; |
+ float authorPathLength = pathLength()->currentValue()->value(); |
+ if (authorPathLength < 0) |
+ return 1; |
+ if (!authorPathLength) |
+ return 0; |
+ float computedPathLength = stylePath()->length(); |
+ if (!computedPathLength) |
+ return 1; |
+ return computedPathLength / authorPathLength; |
+} |
+ |
+Path SVGPathElement::asPath() const |
+{ |
+ return stylePath()->path(); |
} |
const SVGPathByteStream& SVGPathElement::pathByteStream() const |