librsvg uses class attribute order instead of document order during CSS cascade
Forwarding from https://phabricator.wikimedia.org/T215815
I can confirm with librsvg2-2.44.13-1.fc29
and librsvg2-2.45.5-3.fc30
.
As demonstrated by https://upload.wikimedia.org/wikipedia/commons/8/8c/Librsvg_css_bug.svg , librsvg seems to implement CSS cascading incorrectly.
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300">
<style type="text/css">
.red{fill:#f00;}
.blue{fill:#08f;}
</style>
<rect width="100%" height="100%" class="blue red"/>
</svg>
The specs at https://www.w3.org/TR/css3-cascade/#cascade-order specify that "The last declaration in document order wins." (blue in the example), but librsvg apparently favors whichever class was mentioned last in a class attribute (**red ** in the example).
Testcase: