Page MenuHomePhabricator

librsvg uses class attribute order instead of document order during CSS cascade
Open, Needs TriagePublic

Description

As demonstrated by https://commons.wikimedia.org/wiki/File: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).