WICG / intrinsicsize-attribute

Proposal to add an intrinsicsize attribute to media elements
Apache License 2.0
93 stars 14 forks source link

Broken image size #13

Open valtlai opened 5 years ago

valtlai commented 5 years ago

Some browsers ignore the image size (set with HTML attributes or CSS) when rendering broken images (Chrome always and Firefox when a non-empty alt text is provided).

Should browsers preserve the image size? Or should we require that when intrinsicsize attribute is specified?

cathiechen commented 5 years ago

Hi, It seems reasonable to me that we apply intrinsicSize to broken image. I.e., the behavior of broken image is same to normal image. Otherwise, there's a user visible reflow. For instance:

<img intrinsicSize='100 x 50' style='width: 200px;' src='errorImg.png'> text

The first render size of image would be 200 x 100. (intrinsicSize applied). After detecting image error, the image ratio will be set to 1. So the render size of image would become 200 x 200. The text after image would be moved to a new position too.