Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 | 50 |
| 51 // Spec: The transform attribute on the referenced 'path' element represent s a | 51 // Spec: The transform attribute on the referenced 'path' element represent s a |
| 52 // supplemental transformation relative to the current user coordinate syste m for | 52 // supplemental transformation relative to the current user coordinate syste m for |
| 53 // the current 'text' element, including any adjustments to the current user coordinate | 53 // the current 'text' element, including any adjustments to the current user coordinate |
| 54 // system due to a possible transform attribute on the current 'text' elemen t. | 54 // system due to a possible transform attribute on the current 'text' elemen t. |
| 55 // http://www.w3.org/TR/SVG/text.html#TextPathElement | 55 // http://www.w3.org/TR/SVG/text.html#TextPathElement |
| 56 pathData.transform(pathElement.calculateAnimatedLocalTransform()); | 56 pathData.transform(pathElement.calculateAnimatedLocalTransform()); |
| 57 return pathData; | 57 return pathData; |
| 58 } | 58 } |
| 59 | 59 |
| 60 float LayoutSVGTextPath::startOffset() const | 60 static inline bool isPercentageForStartOffset(const LayoutObject* layoutObject) |
| 61 { | 61 { |
| 62 return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsP ercentage(); | 62 return toSVGTextPathElement(layoutObject->node())->startOffset()->currentVal ue()->typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Percentage; |
| 63 } | |
| 64 | |
| 65 float LayoutSVGTextPath::calculateStartOffset(float length) const | |
| 66 { | |
| 67 float textPathStartOffset = toSVGTextPathElement(node())->startOffset()->cur rentValue()->valueAsPercentage(); | |
| 68 if (isPercentageForStartOffset(this)) { | |
|
fs
2016/01/28 15:20:34
This is unnecessarily complicated, just do:
const
| |
| 69 textPathStartOffset *= length; | |
| 70 } | |
| 71 return textPathStartOffset; | |
| 63 } | 72 } |
| 64 | 73 |
| 65 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |