Commit f5372970 authored by fs's avatar fs Committed by Commit bot

Use the right point for marker orientation when closing a subpath

Path::apply doesn't pass a point along for the PathElementCloseSubpath
command. This would yield the wrong orientation on the last marker-mid
on the path (see crbug.com/633012#c1 for an example.)
Use m_subpathStart where needed instead.

BUG=633012

Review-Url: https://codereview.chromium.org/2539763002
Cr-Commit-Position: refs/heads/master@{#434988}
parent cb0f1799
<!DOCTYPE html>
<div style="width: 100px; height: 100px; background-color: green"></div>
<!DOCTYPE html>
<svg width="100">
<marker id="m" overflow="visible" orient="auto" refX="50" refY="50">
<rect width="100" height="100" fill="green"/>
</marker>
<path d="M0,0h100L50,50z" marker-mid="url(#m)" fill="red"/>
</svg>
......@@ -106,14 +106,17 @@ class SVGMarkerData {
return 0;
}
void updateOutslope(const FloatPoint& point) {
void updateOutslope(const PathElement& element) {
m_outslopePoints[0] = m_origin;
FloatPoint point = element.type == PathElementCloseSubpath
? m_subpathStart
: element.points[0];
m_outslopePoints[1] = point;
}
void updateFromPathElement(const PathElement& element) {
// First update the outslope for the previous element.
updateOutslope(element.points[0]);
updateOutslope(element);
// Record the marker for the previous element.
if (m_elementIndex > 0) {
......@@ -148,7 +151,7 @@ class SVGMarkerData {
m_origin = points[0];
break;
case PathElementCloseSubpath:
updateInslope(points[0]);
updateInslope(m_subpathStart);
m_origin = m_subpathStart;
m_subpathStart = FloatPoint();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment