Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp

Issue 1580293008: Fix incorrect handling of small non-percentage value for 'startOffset' on <textPath> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..29964a11682917aff4c91b3109f0de0169291ac0 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGTextPath.cpp
@@ -57,9 +57,14 @@ Path LayoutSVGTextPath::layoutPath() const
return pathData;
}
-float LayoutSVGTextPath::startOffset() const
+float LayoutSVGTextPath::calculateStartOffset(float pathLength) const
{
- return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsPercentage();
+ const SVGLength& startOffset = *toSVGTextPathElement(node())->startOffset()->currentValue();
+ float textPathStartOffset = startOffset.valueAsPercentage();
+ if (startOffset.typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Percentage)
+ textPathStartOffset *= pathLength;
+
+ return textPathStartOffset;
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698