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 20 matching lines...) Expand all Loading... |
31 : m_positionCalculator(path), m_pathLength(path.length()) {} | 31 : m_positionCalculator(path), m_pathLength(path.length()) {} |
32 | 32 |
33 PathPositionMapper::PositionType PathPositionMapper::pointAndNormalAtLength( | 33 PathPositionMapper::PositionType PathPositionMapper::pointAndNormalAtLength( |
34 float length, | 34 float length, |
35 FloatPoint& point, | 35 FloatPoint& point, |
36 float& angle) { | 36 float& angle) { |
37 if (length < 0) | 37 if (length < 0) |
38 return BeforePath; | 38 return BeforePath; |
39 if (length > m_pathLength) | 39 if (length > m_pathLength) |
40 return AfterPath; | 40 return AfterPath; |
41 ASSERT(length >= 0 && length <= m_pathLength); | 41 DCHECK_GE(length, 0); |
| 42 DCHECK_LE(length, m_pathLength); |
42 m_positionCalculator.pointAndNormalAtLength(length, point, angle); | 43 m_positionCalculator.pointAndNormalAtLength(length, point, angle); |
43 return OnPath; | 44 return OnPath; |
44 } | 45 } |
45 | 46 |
46 LayoutSVGTextPath::LayoutSVGTextPath(Element* element) | 47 LayoutSVGTextPath::LayoutSVGTextPath(Element* element) |
47 : LayoutSVGInline(element) {} | 48 : LayoutSVGInline(element) {} |
48 | 49 |
49 bool LayoutSVGTextPath::isChildAllowed(LayoutObject* child, | 50 bool LayoutSVGTextPath::isChildAllowed(LayoutObject* child, |
50 const ComputedStyle&) const { | 51 const ComputedStyle&) const { |
51 if (child->isText()) | 52 if (child->isText()) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 *toSVGTextPathElement(node())->startOffset()->currentValue(); | 84 *toSVGTextPathElement(node())->startOffset()->currentValue(); |
84 float textPathStartOffset = startOffset.valueAsPercentage(); | 85 float textPathStartOffset = startOffset.valueAsPercentage(); |
85 if (startOffset.typeWithCalcResolved() == | 86 if (startOffset.typeWithCalcResolved() == |
86 CSSPrimitiveValue::UnitType::Percentage) | 87 CSSPrimitiveValue::UnitType::Percentage) |
87 textPathStartOffset *= pathLength; | 88 textPathStartOffset *= pathLength; |
88 | 89 |
89 return textPathStartOffset; | 90 return textPathStartOffset; |
90 } | 91 } |
91 | 92 |
92 } // namespace blink | 93 } // namespace blink |
OLD | NEW |