Created attachment 40884 [details]
Demo that shows an example of the issue (works in FF/Opera)
Altering a path using pathSegList methods  fails to properly change the element's "d" attribute, nor is the element painted correctly.
Note that it does correctly add the segment to the pathSegList, as can be discovered by using .getItem(n) or accessing the numberOfItems attribute. But that's pretty useless as the actual shape is not changed.
I have attached an SVG file that attempts to add a segment using insertItemBefore, then checks if the "d" attribute has changed.
Until this is fixed, if someone knows a workaround to accomplish the same effect that does not require manipulating the "d" attribute itself, that would be greatly appreciated. This functionality is needed for adding/removing nodes in the SVG-edit project , and currently only works in Firefox & Opera.
I've looked a little bit into this and found the cause. The function SVGPathSegList::toPathData() is not completely implemented. Working on a patch.
Created attachment 51576 [details]
I've made a tentative patch to fix this which adds code for relative coordinates in SVGPathSegList::toPathData(). If the approach looks good, SVGPathSegList::getPathSegAtLength() needs to be similarly updated as well.
One cause of the problem is bug 26487. It appears that all "Rel" path data commands are internally stored as "Abs" commands. Inserting a "relative lineto" (l - that's a lower case "L") command affects all subsequent data points.
The above patch adds hackery to properly compute the coordinates in SVGPathSegList::toPathData(). The correct fix would be to not convert the data path commands to "Abs" to begin with.
Comment on attachment 51576 [details]
As discussed on webkit-dev, this is probably not the right approach. Did you investigate a bit more, David?
(In reply to comment #4)
> (From update of attachment 51576 [details])
> As discussed on webkit-dev, this is probably not the right approach. Did you
> investigate a bit more, David?
I investigated a bit more, but I haven't had time to come up with a proper solution.
It is now possible to create unaltered SVGPathSegLists. Still use normalized SVGPathSegLists, untill we have a way to synchroinze dAttr, pathSegList and normalizedPathSegList.
*** This bug has been marked as a duplicate of bug 49580 ***