Files
shinyobjectz 0ef2239226 An inline SVG's fill, stroke and the other paint properties set from a stylesheet are drawn, as Chrome draws them (closes #45). raea draws an inline SVG by serializing it and handing the source to usvg, which reads attributes and the style attribute only. Stylo computed #a path { fill: none; stroke: #13502B }, but nothing carried it into the serialized source, so the path was drawn with usvg's defaults: a black square.
blitz-dom's serializer (svg_css_paint) now writes each SVG element's computed paint properties into its style attribute: fill, stroke and their opacities, fill-rule, stroke-width, -linecap, -linejoin, -miterlimit, -dasharray and -dashoffset where they differ from the parent's computed value (they inherit, so a rule on the <svg> stays on the <svg>), and vector-effect where it isn't none. currentcolor is written as the element's color, as presentation attributes already were. The style attribute beats presentation attributes in usvg as in CSS, so a rule's fill wins over a fill="" attribute, as Chrome has it. vendor/stylo now has vector-effect for Servo too (it was Gecko-only), so a stylesheet's non-scaling-stroke reaches the source and isn't reported as not applied.

bench/svg-css-paint/check.sh draws five squares: a and b from a stylesheet rule on the path (a with vector-effect), c with attributes, d with a fill attribute under a rule on the <svg> (the attribute wins, as it's on the path), and e with a rule on the path over a fill attribute (the rule wins). Chrome 148 draws a, b and c as green outlines, d orange and e green. The raea before this drew a and b as black squares and e orange, and noted vector-effect as not applied; the raea with it passes.

WPT css-transforms, an 11-07 build vs this tree (won/lost lists; the newer build has #39 and other lanes' changes too): 18 svg-document-styles, svg-external-styles and svg-inline-styles tests now pass (their transforms' boxes are drawn with CSS fill). Three tests that passed because the test and its reference were drawn equally wrong now fail on their real gaps: svgbox-stroke-box-003/004 (with non-scaling-stroke, Chrome uses stroke-box as fill-box) and css-masking's clip-path-animation-neutral-keyframe-svg-smil (raea doesn't run SMIL <animate>, so the CSS fill shows where Chrome animates it).

fps, the same 120-frame page back to back, three runs each: 3.7, 3.9, 3.5 ms a frame before, 2.4, 3.3, 3.4 after (about 280 fps both).

Upstream candidate: blitz-dom serialize.rs's svg_css_paint (Blitz), stylo's vector-effect for Servo.
2026-11-08 02:15:24 -08:00
..