Open tigt opened 5 years ago
This also strongly overlaps with similar questions for SVG <clipPath>
and <mask>
applied to HTML elements, and for SVG paint effects.
I think Taylor's expectations are a reasonable start. We should look at what other browsers are currently doing (for filters & for these other effects).
Looks like I already have a general purpose tracking issue for this: #249
Taylor: do you think the specifics of the WebKit bug are worth a separate issue, or should we roll it all back into that master one?
This is probably a subset of that bug, but this does further clarify that Safari doesn’t clip the fill to the border-box exactly, what with the box-shadow
behavior.
Filter Effects Level 1 § Filter Region
The problem
WebKit ignores
width
/height
/x
/y
on<filter>
when applied to an HTML element via a CSS reference to that SVG filter. That’s a bit of a mouthful, so hopefully this CodePen of the issue can demonstrate.In Firefox and Chrome, the two green rectangles are positioned and sized identically. They differ in Safari. See WebKit bug #196826.
What I expect to happen
If
filterUnits="objectBoundingBox"
, the filter region attributes should be relative to the element’s border-box, probably.If
filterUnits="userSpaceOnUse"
, the filter region attributes should probably map topx
of the rendered element, with 0,0 as the element’s upper-left corner.(Aside for any Web devs reading this for a solution: Safari’s filter region can be expanded by using a transparent
box-shadow
to extend its paint area. This is probably a hack, though.)