Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp |
| index a243f639f86a085e3d5f00604ec89c8fbf8dde30..6e667f17148b95012d87d732b0ac54c22de9005f 100644 |
| --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp |
| +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp |
| @@ -57,9 +57,18 @@ Path LayoutSVGTextPath::layoutPath() const |
| return pathData; |
| } |
| -float LayoutSVGTextPath::startOffset() const |
| +static inline bool isPercentageForStartOffset(const LayoutObject* layoutObject) |
| { |
| - return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsPercentage(); |
| + return toSVGTextPathElement(layoutObject->node())->startOffset()->currentValue()->typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Percentage; |
| +} |
| + |
| +float LayoutSVGTextPath::calculateStartOffset(float length) const |
| +{ |
| + float textPathStartOffset = toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsPercentage(); |
| + if (isPercentageForStartOffset(this)) { |
|
fs
2016/01/28 15:20:34
This is unnecessarily complicated, just do:
const
|
| + textPathStartOffset *= length; |
| + } |
| + return textPathStartOffset; |
| } |
| } // namespace blink |