Files
shinyobjectz fb7a4e4aeb An SVG shape's transform-box: stroke-box resolves as Chrome's: fill-box under vector-effect: non-scaling-stroke, and wide by a stylesheet's stroke (closes #50). WPT's svgbox-stroke-box-003/004 (a rect with id="target", a 20-wide non-scaling stroke, stroke-box, scale(0.5) translateY(-100%)) drew the rect smaller and off by a few pixels. It used to pass only because, before #45, the test and its reference were both drawn as plain black rects. Three things in blitz-dom were wrong:
- css-transforms-1 (csswg-drafts#9640) uses fill-box for stroke-box and border-box when the shape has vector-effect: non-scaling-stroke. svg_css_transform now does, from the computed value or the attribute.
- svg_stroke_width read stroke and stroke-width from the style attribute and attributes only, so a stylesheet's stroke didn't widen the stroke box (svgbox-stroke-box-001/002 and svgbox-border-box moved by the fill box's size). It now reads each as usvg sees the serialized element: its style attribute, then a rule's computed value that svg_css_paint writes there, then its attribute, then what it inherits.
- A non-scaling stroke reaches anyrender_svg as an id starting raea-nss-, since usvg drops vector-effect but keeps ids. An element with an id of its own was never marked, so its stroke scaled. mark_non_scaling_strokes now renames an element's own id to carry the mark when nothing in the source refers to it (`#id`); a referred-to id keeps its name (and its stroke still scales). The unit test covers both.

bench/svg-stroke-box/check.sh moves two stroked rects by translateX(50%) of their stroke box: a (stylesheet stroke: moves 60) and b (non-scaling stroke with its own id under scaleY(0.5): moves 50, its stroke 20 wide). Chrome 148 gives the probed pixels. The raea before this fails three probes; the raea with it passes. WPT css-transforms transform-box: 15 of the 28 tests Chrome passes before, 20 after (border-box, stroke-box-001 to 004), none lost.

fps, the same 120-frame page back to back, three runs each: 3.2, 3.8, 4.1 ms a frame before, 3.0, 3.8, 3.2 after (about 280 fps both).

Upstream candidate (Blitz): blitz-dom serialize.rs's stroke box and svg.rs's mark (the mark itself is raea's, for anyrender_svg).
2026-11-08 03:20:57 -08:00
..