GNOME Bugzilla – Bug 748565
svg with clippath defined after use does not clip properly
Last modified: 2017-12-13 18:08:29 UTC
If the <def> block containing a <clippath> appears after any elements that use that clip path, they are not clipped. There seems to be nothing in the svg spec which requires that the object refereed to appears above what refers to it. The only place I could find anything about order mentioned was http://www.w3.org/TR/SVG/struct.html#DefsElement which only says that the <def> is 'encouraged' to be a direct child of an ancestor of the node that refers to it. A simple example of this is (from https://github.com/ipython/ipython/issues/8133#issuecomment-93051239): <?xml version="1.0"?> <svg width="120" height="120" viewPort="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100" clip-path="url(#myClip)"/> <defs> <clipPath id="myClip"> <circle cx="30" cy="30" r="20"/> <circle cx="70" cy="70" r="20"/> </clipPath> </defs> </svg> or basically anything emitted by matplotlib's svg backend. This bug has been reported to ubuntu (https://bugs.launchpad.net/ubuntu/+source/librsvg/+bug/1207538) and matplotlib (https://github.com/matplotlib/matplotlib/issues/4341, https://github.com/matplotlib/matplotlib/issues/4179, https://github.com/matplotlib/matplotlib/issues/2277) but apparently never made it upstream.
Still occurring on Ubuntu 15.04 with librsvg2-2 2.40.9-1.
Fixed on Ubuntu 17.04 with eog 3.24.0-0ubuntu1 and librsvg2-2 2.40.16-2~svn1
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/109.