Commit fc36ae93 authored by fmalita's avatar fmalita Committed by Commit bot

[SVG] Fix SVGPathBuilder subpath point tracking

http://crrev.com/1623073003 introduced a bug where moveTos only update
the subpath point when immediately following a closePath.

This is incorrect: moveTos should always update the subpath point.

BUG=581451
R=fs@opera.com,pdr@chromium.org

Review URL: https://codereview.chromium.org/1635323002

Cr-Commit-Position: refs/heads/master@{#371783}
parent 0446d3b4
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg">
<rect x="100" y="100" width="100" height="100" fill="green"/>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg">
<rect x="100" y="100" width="100" height="100" fill="red"/>
<path fill="green" d="
m 100 100
l 50 0
l 0 100
l -50 0
l 0 -100
m 50 0
z
l 50 0
l 0 100
l -50 0
z"/>
</svg>
......@@ -56,12 +56,7 @@ void SVGPathBuilder::emitMoveTo(const FloatPoint& p)
{
m_path.moveTo(p);
// If a "closepath" is followed immediately by a "moveto", then
// the "moveto" identifies the start point of the next subpath.
// [https://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand]
if (m_lastCommand == PathSegClosePath)
m_subpathPoint = p;
m_subpathPoint = p;
m_currentPoint = p;
}
......
......@@ -37,8 +37,7 @@ class SVGPathBuilder final : public SVGPathConsumer {
public:
SVGPathBuilder(Path& path)
: m_path(path)
// Starting in ClosePath state ensures correct handling of the first moveTo.
, m_lastCommand(PathSegClosePath)
, m_lastCommand(PathSegUnknown)
{ }
private:
......
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