Check xlink:href for gradientUnits="userSpaceOnUse"

When considering to prune attributes set to a default values, we
checked the `gradientUnits` attribute first to determine if that was
valid. Unfortunately, we omitted to check whether the `gradientUnits`
attribute was inherited via `xlink:ref`.  This commit corrects that
bug.

Closes: #225
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
Niels Thykier 2021-02-27 22:14:50 +00:00
parent fbf0c06e84
commit e0e3f81632
No known key found for this signature in database
GPG key ID: A65B78DBE67C7AAC
3 changed files with 71 additions and 12 deletions

View file

@ -12,10 +12,20 @@
<stop offset="0" stop-color="black"/>
<stop offset="1" stop-color="white"/>
</linearGradient>
<linearGradient id="grad1d" x2='1' xlink:href="#grad1c">
<stop offset="0" stop-color="black"/>
<stop offset="1" stop-color="white"/>
</linearGradient>
<linearGradient id="grad1e" x2='1' xlink:href="#grad1b">
<stop offset="0" stop-color="black"/>
<stop offset="1" stop-color="white"/>
</linearGradient>
<radialGradient id="grad2" xlink:href="#grad1" cx="50%" cy="0.5" r="50%" fx="50%" fy="0.5"/>
<rect width="100" height="100" fill="url(#grad1)"/>
<rect width="100" height="100" fill="url(#grad1b)"/>
<rect width="100" height="100" fill="url(#grad1c)"/>
<rect width="100" height="100" fill="url(#grad1d)"/>
<rect width="100" height="100" fill="url(#grad1e)"/>
<rect width="50" height="50" fill="url(#grad2)"/>
</svg>

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After