Fix Bug 604000: Correctly remove overflow attributes on marker, pattern, svg
This commit is contained in:
parent
b661e479ea
commit
c17c689ae4
7 changed files with 69 additions and 4 deletions
11
CONTRIBUTORS
11
CONTRIBUTORS
|
|
@ -1,5 +1,16 @@
|
||||||
Thanks to the following contributors to scour:
|
Thanks to the following contributors to scour:
|
||||||
|
|
||||||
|
* Louis Simard
|
||||||
|
Bugs Fixed:
|
||||||
|
- https://bugs.launchpad.net/scour/+bug/583758
|
||||||
|
- https://bugs.launchpad.net/scour/+bug/583458
|
||||||
|
- https://bugs.launchpad.net/scour/+bug/594930
|
||||||
|
- https://bugs.launchpad.net/scour/+bug/576958
|
||||||
|
New features:
|
||||||
|
- https://bugs.launchpad.net/scour/+bug/428069 Remove metadata option.
|
||||||
|
- https://bugs.launchpad.net/scour/+bug/582619 Feature implementations: --quiet, --enable-comment-stripping.
|
||||||
|
- Add options --shorten-ids, --renderer-workaround.
|
||||||
|
|
||||||
* Doug Schepers (W3C SVG WG)
|
* Doug Schepers (W3C SVG WG)
|
||||||
- function to embed rasters as base64 data: URLs
|
- function to embed rasters as base64 data: URLs
|
||||||
- report file size reduction
|
- report file size reduction
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,12 @@
|
||||||
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/577940">Bug 577940</a> to include stroke-dasharray into list of style properties turned into XML attributes.</li>
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/577940">Bug 577940</a> to include stroke-dasharray into list of style properties turned into XML attributes.</li>
|
||||||
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/562784">Bug 562784</a>, typo in Inkscape description</li>
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/562784">Bug 562784</a>, typo in Inkscape description</li>
|
||||||
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/603988">Bug 603988</a>, do not commonize attributes if the element is referenced elsewhere.</li>
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/603988">Bug 603988</a>, do not commonize attributes if the element is referenced elsewhere.</li>
|
||||||
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/604000">Bug 604000</a>, correctly remove default overflow attributes.</li>
|
||||||
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/583758">Bug 583758</a>, added a bit to the Inkscape help text saying that groups aren't collapsed if IDs are also not stripped.</li>
|
||||||
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/583458">Bug 583458</a>, another typo in the Inkscape help tab.</li>
|
||||||
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/594930">Bug 594930</a>, 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.</li>
|
||||||
|
<li>Fix <a href="https://bugs.launchpad.net/scour/+bug/576958">Bug 576958</a>, "Viewbox option doesn't work when units are set", when renderer workarounds are disabled.</li>
|
||||||
|
<li>Added many options: --remove-metadata, --quiet, --enable-comment-stripping, --shorten-ids, --renderer-workaround.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
|
||||||
17
scour.py
17
scour.py
|
|
@ -4,6 +4,7 @@
|
||||||
# Scour
|
# Scour
|
||||||
#
|
#
|
||||||
# Copyright 2010 Jeff Schiller
|
# Copyright 2010 Jeff Schiller
|
||||||
|
# Copyright 2010 Louis Simard
|
||||||
#
|
#
|
||||||
# This file is part of Scour, http://www.codedread.com/scour/
|
# This file is part of Scour, http://www.codedread.com/scour/
|
||||||
#
|
#
|
||||||
|
|
@ -1328,9 +1329,21 @@ def repairStyle(node, options):
|
||||||
del styleMap['display']
|
del styleMap['display']
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
# overflow: visible or overflow specified on element other than svg, marker, pattern
|
|
||||||
if styleMap.has_key('overflow') :
|
if styleMap.has_key('overflow') :
|
||||||
if styleMap['overflow'] == 'visible' or node.nodeName in ['svg','marker','pattern']:
|
# overflow specified on element other than svg, marker, pattern
|
||||||
|
if not node.nodeName in ['svg','marker','pattern']:
|
||||||
|
del styleMap['overflow']
|
||||||
|
num += 1
|
||||||
|
# it is a marker, pattern or svg
|
||||||
|
# as long as this node is not the document <svg>, then only
|
||||||
|
# remove overflow='hidden'. See
|
||||||
|
# http://www.w3.org/TR/2010/WD-SVG11-20100622/masking.html#OverflowProperty
|
||||||
|
elif node != node.ownerDocument.documentElement:
|
||||||
|
if styleMap['overflow'] == 'hidden':
|
||||||
|
del styleMap['overflow']
|
||||||
|
num += 1
|
||||||
|
# else if outer svg has a overflow="visible", we can remove it
|
||||||
|
elif styleMap['overflow'] == 'visible':
|
||||||
del styleMap['overflow']
|
del styleMap['overflow']
|
||||||
num += 1
|
num += 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
# SVG transformation list parser
|
# SVG transformation list parser
|
||||||
#
|
#
|
||||||
# Copyright 2010
|
# Copyright 2010 Louis Simard
|
||||||
#
|
#
|
||||||
# This file is part of Scour, http://www.codedread.com/scour/
|
# This file is part of Scour, http://www.codedread.com/scour/
|
||||||
#
|
#
|
||||||
|
|
|
||||||
14
testscour.py
14
testscour.py
|
|
@ -4,6 +4,7 @@
|
||||||
# Test Harness for Scour
|
# Test Harness for Scour
|
||||||
#
|
#
|
||||||
# Copyright 2010 Jeff Schiller
|
# Copyright 2010 Jeff Schiller
|
||||||
|
# Copyright 2010 Louis Simard
|
||||||
#
|
#
|
||||||
# This file is part of Scour, http://www.codedread.com/scour/
|
# This file is part of Scour, http://www.codedread.com/scour/
|
||||||
#
|
#
|
||||||
|
|
@ -1102,6 +1103,19 @@ class DoNotCommonizeAttributesOnReferencedElements(unittest.TestCase):
|
||||||
doc = scour.scourXmlFile('unittests/commonized-referenced-elements.svg')
|
doc = scour.scourXmlFile('unittests/commonized-referenced-elements.svg')
|
||||||
self.assertEquals(doc.getElementsByTagName('circle')[0].getAttribute('fill'), '#0f0')
|
self.assertEquals(doc.getElementsByTagName('circle')[0].getAttribute('fill'), '#0f0')
|
||||||
|
|
||||||
|
class DoNotRemoveOverflowVisibleOnMarker(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
doc = scour.scourXmlFile('unittests/overflow-marker.svg')
|
||||||
|
self.assertEquals(doc.getElementsByTagName('marker')[0].getAttribute('overflow'), 'visible')
|
||||||
|
self.assertEquals(doc.getElementsByTagName('marker')[1].getAttribute('overflow'), '')
|
||||||
|
|
||||||
|
class MarkerOnSvgElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
doc = scour.scourXmlFile('unittests/overflow-svg.svg')
|
||||||
|
self.assertEquals(doc.getElementsByTagName('svg')[0].getAttribute('overflow'), '')
|
||||||
|
self.assertEquals(doc.getElementsByTagName('svg')[1].getAttribute('overflow'), '')
|
||||||
|
self.assertEquals(doc.getElementsByTagName('svg')[2].getAttribute('overflow'), 'visible')
|
||||||
|
|
||||||
# TODO: write tests for --enable-viewboxing
|
# TODO: write tests for --enable-viewboxing
|
||||||
# TODO; write a test for embedding rasters
|
# TODO; write a test for embedding rasters
|
||||||
# TODO: write a test for --disable-embed-rasters
|
# TODO: write a test for --disable-embed-rasters
|
||||||
|
|
|
||||||
12
unittests/overflow-marker.svg
Normal file
12
unittests/overflow-marker.svg
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<defs>
|
||||||
|
<marker id="m1" style="overflow:visible">
|
||||||
|
<rect width="200" height="100"/>
|
||||||
|
</marker>
|
||||||
|
<marker id="m2" style="overflow:hidden">
|
||||||
|
<rect width="200" height="100"/>
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
<line x2="100" y2="100" style="marker-start:url(#m1);marker-end:url(#m2)" stroke="#000" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 438 B |
9
unittests/overflow-svg.svg
Normal file
9
unittests/overflow-svg.svg
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="overflow:visible">
|
||||||
|
<svg style="overflow:hidden">
|
||||||
|
<line x2="100" y2="100" stroke="#000" />
|
||||||
|
</svg>
|
||||||
|
<svg style="overflow:visible">
|
||||||
|
<line x2="100" y2="100" stroke="#000" />
|
||||||
|
</svg>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 344 B |
Loading…
Add table
Add a link
Reference in a new issue