(Partial?) fix for bug 594930: In a <switch>, require one level of <g> if there was a <g> in the file already. Otherwise, only the first subelement of the <g> is chosen and rendered.

This commit is contained in:
Cynthia Gauthier 2010-06-16 02:29:01 -04:00
parent 26d90a7529
commit bb1a38a7ad

View file

@ -749,9 +749,12 @@ def removeNestedGroups(node):
num = 0
groupsToRemove = []
# Only consider <g> elements for promotion if this element isn't a <switch>.
# (partial fix for bug 594930, required by the SVG spec however)
if not (node.nodeType == 1 and node.nodeName == 'switch'):
for child in node.childNodes:
if child.nodeName == 'g' and child.namespaceURI == NS['SVG'] and len(child.attributes) == 0:
# only collapse group if it does not have a title or desc as a direct descendant
# only collapse group if it does not have a title or desc as a direct descendant,
for grandchild in child.childNodes:
if grandchild.nodeType == 1 and grandchild.namespaceURI == NS['SVG'] and \
grandchild.nodeName in ['title','desc']: