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

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

Issue 1376523002: Support 'pathLength' for stroking operations on <path> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove double space 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/SVGLayoutSupport.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
index 51f3e979d94c282abea135b758f13e1e66e1813a..59ea565b1101fbca4451f940cda413a70e1f2c12 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -372,7 +372,7 @@ DashArray SVGLayoutSupport::resolveSVGDashArray(const SVGDashArray& svgDashArray
return dashArray;
}
-void SVGLayoutSupport::applyStrokeStyleToStrokeData(StrokeData& strokeData, const ComputedStyle& style, const LayoutObject& object)
+void SVGLayoutSupport::applyStrokeStyleToStrokeData(StrokeData& strokeData, const ComputedStyle& style, const LayoutObject& object, float dashScaleFactor)
{
ASSERT(object.node());
ASSERT(object.node()->isSVGElement());
@@ -386,7 +386,15 @@ void SVGLayoutSupport::applyStrokeStyleToStrokeData(StrokeData& strokeData, cons
strokeData.setMiterLimit(svgStyle.strokeMiterLimit());
DashArray dashArray = resolveSVGDashArray(*svgStyle.strokeDashArray(), style, lengthContext);
- strokeData.setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeDashOffset(), style));
+ float dashOffset = lengthContext.valueForLength(svgStyle.strokeDashOffset(), style);
+ // Apply scaling from 'pathLength'.
+ if (dashScaleFactor != 1) {
+ ASSERT(dashScaleFactor >= 0);
+ dashOffset *= dashScaleFactor;
+ for (auto& dashItem : dashArray)
+ dashItem *= dashScaleFactor;
+ }
+ strokeData.setLineDash(dashArray, dashOffset);
}
bool SVGLayoutSupport::isLayoutableTextNode(const LayoutObject* object)

Powered by Google App Engine
This is Rietveld 408576698