Fix bug 702423, "Scour corrupts icons with gradients when --disable-style-to-xml is used". Add 2 more full tests gathered from the bug reports, as well as 1 more unit test.

This commit is contained in:
Louis Simard 2011-03-12 03:22:03 -05:00
parent fcbb2b0332
commit 437dbf991c
5 changed files with 489 additions and 0 deletions

View file

@ -1291,6 +1291,12 @@ def removeDuplicateGradients(doc):
elem.setAttribute(attr, 'url(#'+master_id+')')
if elem.getAttributeNS(NS['XLINK'], 'href') == '#'+dup_id:
elem.setAttributeNS(NS['XLINK'], 'href', '#'+master_id)
styles = _getStyle(elem)
for style in styles:
v = styles[style]
if v == 'url(#'+dup_id+')' or v == 'url("#'+dup_id+'")' or v == "url('#"+dup_id+"')":
styles[style] = 'url(#'+master_id+')'
_setStyle(elem, styles)
# now that all referencing elements have been re-mapped to the master
# it is safe to remove this gradient from the document