[Webkit-unassigned] [Bug 146383] If src is empty in img tag it shows a gray border around the image

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 16 15:29:15 PST 2016


--- Comment #2 from Said Abou-Hallawa <sabouhallawa at apple.com> ---
I tried to look for the specs of drawing the broken images but I could not find this part. WebKit, Chrome and FireFox intentionally draw this gray rect for the broken image. WebKit does that in RenderImage::paintReplaced() below the the statement:

 if (!imageResource().hasImage() || imageResource().errorOccurred()) 

This request is little bit strange. What exactly you are trying to achieve? If drawing the gray rect is bothering you, you can set the width and/or the height of the image to zero. When the src attribute is set to the image, the width and the height can be changed to the desired size. If you want to keep the empty space of the broken image but not to draw the gray rectangle, you can put the <img> inside a box with the desired size but set the width and the height of the image itself to zero.

I attached a test case showing two broken images, one image has size = (100, 100) which shows the gray rectangle. The other image has size = (0, 0) but it is inside a box with size = (100, 100).

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161116/eacd7572/attachment-0001.html>

More information about the webkit-unassigned mailing list