NEW 203788
Don't show the broken image icon for missing CSS images
https://bugs.webkit.org/show_bug.cgi?id=203788
Summary Don't show the broken image icon for missing CSS images
Simon Fraser (smfr)
Reported 2019-11-02 12:25:46 PDT
We currently render the broken image icon for missing CSS images (backgrounds, border-image etc) but I don't think we should. I think we should only show it for content images.
Attachments
Some examples (983 bytes, text/html)
2021-10-18 22:00 PDT, Simon Fraser (smfr)
no flags
Said Abou-Hallawa
Comment 1 2019-11-04 10:10:39 PST
(In reply to Simon Fraser (smfr) from comment #0) > We currently render the broken image icon for missing CSS images > (backgrounds, border-image etc) but I don't think we should. I think we > should only show it for content images. How can this happen? Can you include a test case? In RenderBoxModelObject::paintFillLayerExtended() we check: bool shouldPaintBackgroundImage = bgImage && bgImage->canRender(this, style().effectiveZoom()); If the image is missing, bgImage will be null. And if an error happens while loading or decoding the image, bgImage->canRender() will return false. In both cases drawing the background image step will be skipped.
Simon Fraser (smfr)
Comment 2 2019-11-04 10:27:38 PST
I think I was seeing this for border-image.
Sam Sneddon [:gsnedders]
Comment 3 2021-10-12 02:42:31 PDT
*** Bug 231078 has been marked as a duplicate of this bug. ***
Sam Sneddon [:gsnedders]
Comment 4 2021-10-12 02:48:13 PDT
(In reply to Simon Fraser (smfr) from comment #2) > I think I was seeing this for border-image. Bug 206909 was caused by us rendering `content: -webkit-image-set(url(...))` given an invalid image.
Sam Sneddon [:gsnedders]
Comment 5 2021-10-12 08:44:10 PDT
Simon Fraser (smfr)
Comment 6 2021-10-18 21:16:30 PDT
I can't figure out how to reproduce this now.
Simon Fraser (smfr)
Comment 7 2021-10-18 21:40:31 PDT
This is one way: background-image: -webkit-cross-fade(url('http://www.example.com/broken.png'), url('http://www.example.com/broken.png'), 50%); I think it's bad that CachedImage::image() and CachedImage::imageForRenderer() can return the broken image icon. That causes hilarity like consulting this image for it's opaqueness, or EXIF orientation, even if it's never used in this context (e.g. CSS backgrounds).
Simon Fraser (smfr)
Comment 8 2021-10-18 22:00:42 PDT
Created attachment 441689 [details] Some examples
Sam Sneddon [:gsnedders]
Comment 9 2021-10-19 05:30:03 PDT
(In reply to Simon Fraser (smfr) from comment #6) > I can't figure out how to reproduce this now. content: -webkit-image-set(url('http://www.example.com/broken.png') 1x); still suffices too should really go through and add a whole bunch of WPT tests for this, in the various places where <image> is used as the value
Sam Sneddon [:gsnedders]
Comment 10 2022-10-31 03:46:41 PDT
Ryan Reno
Comment 11 2023-05-22 09:07:27 PDT
The images level 4 spec introduced the concept of an invalid image: http://w3c.github.io/csswg-drafts/css-images-4/#invalid-image I implemented this as a StyleInvalidImage for use in image-set in 261015@main Maybe this is useful in the contexts described in this bug too?
Note You need to log in before you can comment on or make changes to this bug.