OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 textPathElement.hrefString(), treeScopeForIdResolution(textPathElement)); | 66 textPathElement.hrefString(), treeScopeForIdResolution(textPathElement)); |
67 | 67 |
68 if (!isSVGPathElement(targetElement)) | 68 if (!isSVGPathElement(targetElement)) |
69 return nullptr; | 69 return nullptr; |
70 | 70 |
71 SVGPathElement& pathElement = toSVGPathElement(*targetElement); | 71 SVGPathElement& pathElement = toSVGPathElement(*targetElement); |
72 Path pathData = pathElement.asPath(); | 72 Path pathData = pathElement.asPath(); |
73 if (pathData.isEmpty()) | 73 if (pathData.isEmpty()) |
74 return nullptr; | 74 return nullptr; |
75 | 75 |
76 // Spec: The transform attribute on the referenced 'path' element represents
a | 76 // Spec: The transform attribute on the referenced 'path' element represents |
77 // supplemental transformation relative to the current user coordinate system
for | 77 // a supplemental transformation relative to the current user coordinate |
78 // the current 'text' element, including any adjustments to the current user c
oordinate | 78 // system for the current 'text' element, including any adjustments to the |
79 // system due to a possible transform attribute on the current 'text' element. | 79 // current user coordinate system due to a possible transform attribute on the |
80 // http://www.w3.org/TR/SVG/text.html#TextPathElement | 80 // current 'text' element. http://www.w3.org/TR/SVG/text.html#TextPathElement |
81 pathData.transform(pathElement.calculateAnimatedLocalTransform()); | 81 pathData.transform(pathElement.calculateAnimatedLocalTransform()); |
82 | 82 |
83 return PathPositionMapper::create(pathData); | 83 return PathPositionMapper::create(pathData); |
84 } | 84 } |
85 | 85 |
86 float LayoutSVGTextPath::calculateStartOffset(float pathLength) const { | 86 float LayoutSVGTextPath::calculateStartOffset(float pathLength) const { |
87 const SVGLength& startOffset = | 87 const SVGLength& startOffset = |
88 *toSVGTextPathElement(node())->startOffset()->currentValue(); | 88 *toSVGTextPathElement(node())->startOffset()->currentValue(); |
89 float textPathStartOffset = startOffset.valueAsPercentage(); | 89 float textPathStartOffset = startOffset.valueAsPercentage(); |
90 if (startOffset.typeWithCalcResolved() == | 90 if (startOffset.typeWithCalcResolved() == |
91 CSSPrimitiveValue::UnitType::Percentage) | 91 CSSPrimitiveValue::UnitType::Percentage) |
92 textPathStartOffset *= pathLength; | 92 textPathStartOffset *= pathLength; |
93 | 93 |
94 return textPathStartOffset; | 94 return textPathStartOffset; |
95 } | 95 } |
96 | 96 |
97 } // namespace blink | 97 } // namespace blink |
OLD | NEW |