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

Unified Diff: Source/core/svg/SVGPathParser.cpp

Issue 1015433003: Don't handle out-of-range parameters for arcs in UnalteredParsing mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
« no previous file with comments | « LayoutTests/svg/dom/script-tests/path-parser.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGPathParser.cpp
diff --git a/Source/core/svg/SVGPathParser.cpp b/Source/core/svg/SVGPathParser.cpp
index 39eade0ce56f10a7c6fb346903188bf5ce824c60..261df8aebede839884bdc4e68040e9d0ffa5ae66 100644
--- a/Source/core/svg/SVGPathParser.cpp
+++ b/Source/core/svg/SVGPathParser.cpp
@@ -246,6 +246,11 @@ bool SVGPathParser::parseArcToSegment()
if (!m_source->parseArcToSegment(rx, ry, angle, largeArc, sweep, targetPoint))
return false;
+ if (m_pathParsingMode == UnalteredParsing) {
+ m_consumer->arcTo(rx, ry, angle, largeArc, sweep, targetPoint, m_mode);
+ return true;
+ }
+
kouhei (in TOK) 2015/03/17 01:57:46 Nit: Might want to add ASSERT(m_pathParsingMode ==
fs 2015/03/17 09:28:28 With the follow-ups I have this is going to be mor
// If rx = 0 or ry = 0 then this arc is treated as a straight line segment (a "lineto") joining the endpoints.
// http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters
// If the current point and target point for the arc are identical, it should be treated as a zero length
@@ -253,33 +258,24 @@ bool SVGPathParser::parseArcToSegment()
rx = fabsf(rx);
ry = fabsf(ry);
bool arcIsZeroLength = false;
- if (m_pathParsingMode == NormalizedParsing) {
+ if (m_mode == RelativeCoordinates)
+ arcIsZeroLength = targetPoint == FloatPoint::zero();
+ else
+ arcIsZeroLength = targetPoint == m_currentPoint;
+ if (!rx || !ry || arcIsZeroLength) {
if (m_mode == RelativeCoordinates)
- arcIsZeroLength = targetPoint == FloatPoint::zero();
+ m_currentPoint += targetPoint;
else
- arcIsZeroLength = targetPoint == m_currentPoint;
- }
- if (!rx || !ry || arcIsZeroLength) {
- if (m_pathParsingMode == NormalizedParsing) {
- if (m_mode == RelativeCoordinates)
- m_currentPoint += targetPoint;
- else
- m_currentPoint = targetPoint;
- m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
- } else
- m_consumer->lineTo(targetPoint, m_mode);
+ m_currentPoint = targetPoint;
+ m_consumer->lineTo(m_currentPoint, AbsoluteCoordinates);
return true;
}
- if (m_pathParsingMode == NormalizedParsing) {
- FloatPoint point1 = m_currentPoint;
- if (m_mode == RelativeCoordinates)
- targetPoint += m_currentPoint;
- m_currentPoint = targetPoint;
- return decomposeArcToCubic(angle, rx, ry, point1, targetPoint, largeArc, sweep);
- }
- m_consumer->arcTo(rx, ry, angle, largeArc, sweep, targetPoint, m_mode);
- return true;
+ FloatPoint point1 = m_currentPoint;
+ if (m_mode == RelativeCoordinates)
+ targetPoint += m_currentPoint;
+ m_currentPoint = targetPoint;
+ return decomposeArcToCubic(angle, rx, ry, point1, targetPoint, largeArc, sweep);
}
bool SVGPathParser::parsePathDataFromSource(PathParsingMode pathParsingMode, bool checkForInitialMoveTo)
« no previous file with comments | « LayoutTests/svg/dom/script-tests/path-parser.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698