+2006-03-05 Alexander Kellett <lypanov@kde.org>
+
+ Reviewed by Eric.
+
+ - new reduced testcases for:
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6951
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6890
+
+ * svg/custom/polyline-invalid-points.svg: Added.
+ * svg/custom/polyline-setattribute-points-null.svg: Added.
+
2006-03-05 Mitz Pettel <opendarwin.org@mitzpettel.com>
Reviewed by Darin, landed by ap.
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" onload="init()">
+
+ <script>
+ var d;
+ function init()
+ {
+ var polyline = document.createElementNS("http://www.w3.org/2000/svg", "polyline");
+ polyline.setAttribute("points", d);
+ var g = document.getElementById("container");
+ g.appendChild(polyline);
+ // verify that the script arrived here without error by filling the rectangle with green
+ document.getElementById("passed").setAttribute("fill", "green");
+ }
+ </script>
+
+ <rect id="passed" x="0" y="0" width="100" height="100" fill="red"/>
+ <g id="container"></g>
+
+</svg>
+2006-03-05 Alexander Kellett <lypanov@kde.org>
+
+ Reviewed by Eric.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6890
+ and http://bugzilla.opendarwin.org/show_bug.cgi?id=6951
+ by being more tolerant towards invalid points data
+
+ - new tests:
+ svg/custom/polyline-setattribute-points-null.svg
+ svg/custom/polyline-invalid-points.svg
+
+ * ksvg2/svg/svgpathparser.cpp:
+ (SVGPolyParser::parsePoints):
+
2006-03-05 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Eric.
/* This file is part of the KDE project
Copyright (C) 2002, 2003 The Karbon Developers
+ 2006 Alexander Kellett <lypanov@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
return ptr;
}
-void
-SVGPolyParser::parsePoints( const QString &s ) const
+void SVGPolyParser::parsePoints(const QString &s) const
{
- if(!s.isEmpty())
- {
- QString points = s;
- points = points.replace(',', ' ');
- points = points.simplifyWhiteSpace();
- const char *ptr = points.latin1();
- const char *end = points.latin1() + points.length();
-
- double curx = 0, cury = 0;
- int nr = 0;
- while( ptr < end )
- {
- //std::cout << "ptr : " << ptr << std::endl;
- //std::cout << "end : " << end << std::endl;
- ptr = parseCoord( ptr, curx );
- if( *ptr == ',' || *ptr == ' ' )
- ptr++;
- ptr = parseCoord( ptr, cury );
- svgPolyTo( curx, cury, nr++ );
- if( *ptr == ' ' )
- ptr++;
+ if (!s.isEmpty()) {
+ QString pointData = s;
+ pointData = pointData.replace(',', ' ');
+ pointData = pointData.simplifyWhiteSpace();
+ const char* currSegment = pointData.latin1();
+ const char* eoString = pointData.latin1() + pointData.length();
+
+ int segmentNum = 0;
+ while (currSegment < eoString) {
+ const char* prevSegment = currSegment;
+ double xPos = 0;
+ currSegment = parseCoord(currSegment, xPos);
+ if (currSegment == prevSegment)
+ break;
+
+ if (*currSegment == ',' || *currSegment == ' ')
+ currSegment++;
+
+ prevSegment = currSegment;
+ double yPos = 0;
+ currSegment = parseCoord(currSegment, yPos);
+ if (currSegment == prevSegment)
+ break;
+
+ svgPolyTo(xPos, yPos, segmentNum++);
+ if (*currSegment == ' ')
+ currSegment++;
}
}
}