Repository navigation
Conversation
A linear gradient referencing a radial gradient which references another linear gradient no longer picks up x1...y2 from the outer linear gradient.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
==========================================
+ Coverage 89.05% 89.07% +0.01%
==========================================
Files 167 167
Lines 13589 13607 +18
==========================================
+ Hits 12102 12120 +18
Misses 1487 1487 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Closing: skipping other-kind links when resolving gradient geometry matches browsers and resvg (and #142), so the current behaviour on main is correct. |
|
Reopening: I closed this on a wrong assumption. Rendering the mixed chain with resvg shows it stops geometry at the other-kind link, which is what this PR does. |
|
Closing for good: rendering a linear → radial → linear chain (only the last sets x1) in Safari and Chrome inherits the geometry through the radial link, the same as the current behaviour on main and #142. resvg is the outlier here (it stops at the other-kind link), so main is the behaviour to keep. |
Follow-up to #143.
Per SVG 1.1 §13.2.2 and §13.2.3, geometry (
x1…y2,cx…fr) is inherited only from gradients of the same kind.makeGradientskipped over other-kind links in the href chain, so a linear gradient referencing a radial gradient which referenced another linear gradient picked up the outer linear gradient's geometry.Geometry is now read only from the leading run of same-kind gradients in the chain. Units, transform and stops still inherit across kinds.
Adds
testLinearGradient_DoesNotInheritGeometry_ThroughDifferentKind, which fails without the fix.Verified against resvg: for a linear → radial → linear chain where only the last gradient sets
x1, resvg renders the same as whenx1is not set at all, i.e. geometry does not pass through the radial gradient. A direct linear → linear reference does inherit it.