Avoid removal of some additional styles if they might be inherited by a child
This commit is contained in:
parent
1cde426009
commit
0b5eab7f2f
1 changed files with 5 additions and 5 deletions
|
|
@ -1456,7 +1456,7 @@ def repairStyle(node, options):
|
||||||
for uselessStyle in ['fill', 'fill-opacity', 'fill-rule', 'stroke', 'stroke-linejoin',
|
for uselessStyle in ['fill', 'fill-opacity', 'fill-rule', 'stroke', 'stroke-linejoin',
|
||||||
'stroke-opacity', 'stroke-miterlimit', 'stroke-linecap', 'stroke-dasharray',
|
'stroke-opacity', 'stroke-miterlimit', 'stroke-linecap', 'stroke-dasharray',
|
||||||
'stroke-dashoffset', 'stroke-opacity'] :
|
'stroke-dashoffset', 'stroke-opacity'] :
|
||||||
if uselessStyle in styleMap:
|
if uselessStyle in styleMap and not styleInheritedByChild(node, uselessStyle):
|
||||||
del styleMap[uselessStyle]
|
del styleMap[uselessStyle]
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
|
|
@ -1477,7 +1477,7 @@ def repairStyle(node, options):
|
||||||
# if fill:none, then remove all fill-related properties (fill-rule, etc)
|
# if fill:none, then remove all fill-related properties (fill-rule, etc)
|
||||||
if 'fill' in styleMap and styleMap['fill'] == 'none' :
|
if 'fill' in styleMap and styleMap['fill'] == 'none' :
|
||||||
for fillstyle in [ 'fill-rule', 'fill-opacity' ] :
|
for fillstyle in [ 'fill-rule', 'fill-opacity' ] :
|
||||||
if fillstyle in styleMap :
|
if fillstyle in styleMap and not styleInheritedByChild(node, fillstyle):
|
||||||
del styleMap[fillstyle]
|
del styleMap[fillstyle]
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
|
|
@ -1486,7 +1486,7 @@ def repairStyle(node, options):
|
||||||
fillOpacity = float(styleMap['fill-opacity'])
|
fillOpacity = float(styleMap['fill-opacity'])
|
||||||
if fillOpacity == 0.0 :
|
if fillOpacity == 0.0 :
|
||||||
for uselessFillStyle in [ 'fill', 'fill-rule' ] :
|
for uselessFillStyle in [ 'fill', 'fill-rule' ] :
|
||||||
if uselessFillStyle in styleMap:
|
if uselessFillStyle in styleMap and not styleInheritedByChild(node, uselessFillStyle):
|
||||||
del styleMap[uselessFillStyle]
|
del styleMap[uselessFillStyle]
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
|
|
@ -1496,7 +1496,7 @@ def repairStyle(node, options):
|
||||||
if strokeOpacity == 0.0 :
|
if strokeOpacity == 0.0 :
|
||||||
for uselessStrokeStyle in [ 'stroke', 'stroke-width', 'stroke-linejoin', 'stroke-linecap',
|
for uselessStrokeStyle in [ 'stroke', 'stroke-width', 'stroke-linejoin', 'stroke-linecap',
|
||||||
'stroke-dasharray', 'stroke-dashoffset' ] :
|
'stroke-dasharray', 'stroke-dashoffset' ] :
|
||||||
if uselessStrokeStyle in styleMap:
|
if uselessStrokeStyle in styleMap and not styleInheritedByChild(node, uselessStrokeStyle):
|
||||||
del styleMap[uselessStrokeStyle]
|
del styleMap[uselessStrokeStyle]
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
|
|
@ -1506,7 +1506,7 @@ def repairStyle(node, options):
|
||||||
if strokeWidth.value == 0.0 :
|
if strokeWidth.value == 0.0 :
|
||||||
for uselessStrokeStyle in [ 'stroke', 'stroke-linejoin', 'stroke-linecap',
|
for uselessStrokeStyle in [ 'stroke', 'stroke-linejoin', 'stroke-linecap',
|
||||||
'stroke-dasharray', 'stroke-dashoffset', 'stroke-opacity' ] :
|
'stroke-dasharray', 'stroke-dashoffset', 'stroke-opacity' ] :
|
||||||
if uselessStrokeStyle in styleMap:
|
if uselessStrokeStyle in styleMap and not styleInheritedByChild(node, uselessStrokeStyle):
|
||||||
del styleMap[uselessStrokeStyle]
|
del styleMap[uselessStrokeStyle]
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue