Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Bad SVG renders

46 views
Skip to first unread message

Thierry Seegers

unread,
Feb 5, 2025, 9:48:48 AMFeb 5
to skia-discuss
Hi all,

This may boil down to just a bug report on Skia but I'm also curious to ask the question: what does Chromium use to render SVGs? I have two SVG files (attached) that render correctly when simply loaded in Chrome but incorrectly when rendered in the Skia viewer. It feels as though the "layers" are not rendered in the correct order.



Thanks for your help!

bungeman

unread,
Feb 5, 2025, 10:59:10 AMFeb 5
to skia-discuss
Chromium / Blink has its own SVG and CSS (and many other) parsers which are very tied to all of Blink, and doesn't use the one in Skia. The advantage of using the one in Skia is that it doesn't pull in all of Blink, but this has the disadvantage of not pulling in all of Blink.

In test_1.svg the "green" color is from `<style>.st0{fill:#8aff00}</style>` using the style element and applied with the attribute `class="st0"`m but Skia's SVG parser doesn't support the `style` element or the `class` attribute (mostly no support for "generic" CSS) so the color defaults to black. The yellow color is specified like `style="fill:#e6ff00"` with a style attribute which is supported. The list of elements and attributes currently supported can be found at https://skia.googlesource.com/skia.git/+/aae3b796bd2b31d4fc41165783b22aebb3ad4af9/modules/svg/src/SkSVGDOM.cpp#221

Reply all
Reply to author
Forward
0 new messages