Open dirkschulze opened 6 years ago
(FWIW, I tend to think that if you forgot to fill the content with something reasonable, it is probably better just close the issue, and optionally leave a comment mentioning that this was a mistake, then open a new one. This way people wouldn't need to open the GitHub page to know what's happening, and the content can be properly archived in W3C mailing list as well.)
I used this simple example to verify the behavior in implementations:
<svg width="100%" height="220" style="outline: 1px solid red" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<filter id="convolve">
<feFlood flood-color="green" result="flood"/>
<feConvolveMatrix kernelMatrix="1 0 0 0 1 0 0 0 -1 0" in="SourceGraphic" result="kernel"/>
<feComposite operator="over" in="kernel" in2="flood"/>
</filter>
</defs>
<g font-size="3em">
<text x="225" y="75">Convolve</text>
<text x="225" y="150" filter="url(#convolve)">Convolve</text>
</g>
</svg>
feConvolveMatrix
as transparent black on failing preconditions.The pass through seems to be more in line to the behavior of browsers with failing preconditions on feColorMatrix
's values
attribute. Here all browsers use the "initial value" instead which makes the filter a pass-through.
Edit: Added results for Edge
I would expect that an invalid kernelMatrix
value would be treated equivalently to no kernelMatrix
attribute at all.
This was effectively how it worked with <feColorMatrix>
, even if it wasn't explicitly specified. The fact that this causes the primitive to becomes a no-op or "pass-through" effect is a consequence of those initial values. However, <feConvolveMatrix>
didn't have clearly defined default values to start out with.
I'm certainly happy to define it such that invalid values result in a no-op primitive, but I'd like to be clear that a missing kernelMatrix
attribute has the same effect as an invalid one. The edits in https://github.com/w3c/fxtf-drafts/commit/581a079952d5103750cdf3612a8d8dbbc0fd4221 seem to me to be working around the issue without clearly defining an initial value for kernelMatrix
.
PS, a correction: Edge doesn't treat the <feConvolveMatrix>
with incorrect # of values in kernelMatrix
as a no-op. Instead, it seems to pad the value with zeros or truncate extras. It just happened that for the default 3x3 order in your example, that resulted in something close to a no-op effect. You might want to double check the Illustrator/Photoshop results for a different matrix, or when you throw a different order
attribute on your example (order="4"
creates a noticeable blur in Edge).
👍
feConvolveMatrix does specify conditions for attributes but does not specify what happens if those conditions were not fulfilled by the author.