OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 DEFINE_TRACE(SVGPathElement) | 62 DEFINE_TRACE(SVGPathElement) |
63 { | 63 { |
64 visitor->trace(m_pathLength); | 64 visitor->trace(m_pathLength); |
65 visitor->trace(m_path); | 65 visitor->trace(m_path); |
66 SVGGeometryElement::trace(visitor); | 66 SVGGeometryElement::trace(visitor); |
67 } | 67 } |
68 | 68 |
69 DEFINE_NODE_FACTORY(SVGPathElement) | 69 DEFINE_NODE_FACTORY(SVGPathElement) |
70 | 70 |
| 71 const StylePath* SVGPathElement::stylePath() const |
| 72 { |
| 73 if (LayoutObject* layoutObject = this->layoutObject()) |
| 74 return layoutObject->styleRef().svgStyle().d(); |
| 75 return m_path->currentValue()->pathValue()->cachedPath(); |
| 76 } |
| 77 |
| 78 float SVGPathElement::pathLengthScaleFactor() const |
| 79 { |
| 80 if (!pathLength()->isSpecified()) |
| 81 return 1; |
| 82 float authorPathLength = pathLength()->currentValue()->value(); |
| 83 if (authorPathLength < 0) |
| 84 return 1; |
| 85 if (!authorPathLength) |
| 86 return 0; |
| 87 float computedPathLength = stylePath()->length(); |
| 88 if (!computedPathLength) |
| 89 return 1; |
| 90 return computedPathLength / authorPathLength; |
| 91 } |
| 92 |
71 Path SVGPathElement::asPath() const | 93 Path SVGPathElement::asPath() const |
72 { | 94 { |
73 if (layoutObject()) { | 95 return stylePath()->path(); |
74 const SVGComputedStyle& svgStyle = layoutObject()->styleRef().svgStyle()
; | |
75 return svgStyle.d()->path(); | |
76 } | |
77 | |
78 return m_path->currentValue()->pathValue()->cachedPath()->path(); | |
79 } | 96 } |
80 | 97 |
81 const SVGPathByteStream& SVGPathElement::pathByteStream() const | 98 const SVGPathByteStream& SVGPathElement::pathByteStream() const |
82 { | 99 { |
83 if (layoutObject()) { | 100 if (layoutObject()) { |
84 const SVGComputedStyle& svgStyle = layoutObject()->styleRef().svgStyle()
; | 101 const SVGComputedStyle& svgStyle = layoutObject()->styleRef().svgStyle()
; |
85 return svgStyle.d()->byteStream(); | 102 return svgStyle.d()->byteStream(); |
86 } | 103 } |
87 | 104 |
88 return m_path->currentValue()->byteStream(); | 105 return m_path->currentValue()->byteStream(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return InsertionDone; | 199 return InsertionDone; |
183 } | 200 } |
184 | 201 |
185 void SVGPathElement::removedFrom(ContainerNode* rootParent) | 202 void SVGPathElement::removedFrom(ContainerNode* rootParent) |
186 { | 203 { |
187 SVGGeometryElement::removedFrom(rootParent); | 204 SVGGeometryElement::removedFrom(rootParent); |
188 invalidateMPathDependencies(); | 205 invalidateMPathDependencies(); |
189 } | 206 } |
190 | 207 |
191 } // namespace blink | 208 } // namespace blink |
OLD | NEW |