Firefox fails to paint svg-as-an-image, if the svg element has a width or height of 0 and no viewBox
Categories
(Core :: SVG, defect)
Tracking
()
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
Filing this as the underlying defect behind our WPT failure in bug 1906145.
Essentially, if an SVG image lacks a viewBox, and has a zero-sized width or height, then I think we synthesize a zero-sized viewBox from its width and height, and that means we don't paint anything when the image draws (because we scale up a zero-sized area to fill the image element's bounds, or something like that).
Other browsers do in fact paint in this case, though -- I suspect because they just decline to synthesize a viewBox from the SVG image's height and width, and they instead just use a viewBox based on the area that we're rendering to (the image element), or something along those lines.
Assignee | ||
Updated•2 months ago
|
Assignee | ||
Comment 1•2 months ago
|
||
Assignee | ||
Comment 2•2 months ago
|
||
Assignee | ||
Comment 3•2 months ago
|
||
Assignee | ||
Comment 4•2 months ago
|
||
In all three testcases, we fail to paint the SVG in the top half of the testcase, whereas other engines reliably paint (when there's area to be painted).
Specifically:
- Firefox renders the top half with no cyan (i.e. not painting any content from the SVG image)
- Chromium renders the the top half with cyan backgrounds (for the img elements that are nonzero-sized).
- WebKit renders the top half with cyan backgrounds. (They also render all the img elements as being nonzero-sized, which disagrees with us and Chrome -- this sizing behavior is probably a WebKit bug).
Assignee | ||
Comment 5•2 months ago
•
|
||
When fixing this, I plan to include (possibly-evolved-a-bit) versions of those 3 testcases as WPTs, along with similar tests for <embed>, <svg:image>, SVG-as-a-background-image-with-background-size
, etc. (in all cases having width and/or height set to 0
on the <svg>
element, but nonzero width and/or height on the embedding context).
Description
•