image width and height is wrong
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: david.vantyghem, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0
Steps to reproduce:
Display https://infolib.re/blog/recuperer-un-programme-dans-un-automate-telemecanique/
Actual results:
With new version 150.0.2, some images are displayed with a good size but others are now displayed with a wrong size, there's another regression after solving https://bugzilla.mozilla.org/show_bug.cgi?id=2035156.
By example, this image https://infolib.re/blog/wp-content/uploads/2023/12/Cable-PC-Terminal-Magelis.jpeg is displayed wrongly in https://infolib.re/blog/recuperer-un-programme-dans-un-automate-telemecanique/
Expected results:
The image should be displayed like in https://infolib.re/blog/wp-content/uploads/2023/12/Cable-PC-Terminal-Magelis.jpeg
| Reporter | ||
Comment 1•3 months ago
|
||
This image is displayed too big since 150.0.2 version.
Comment 2•3 months ago
|
||
The image is now showing the same size in Firefox 150.0.2 as it does in Google Chrome and Microsoft Edge.
| Reporter | ||
Comment 3•3 months ago
|
||
I don't use Chrome and Edge. I use Firefox. The image was displayed at a good size by Firefox before 150.0.2 version, now it's too huge and not at the size chosen in WordPress.
| Reporter | ||
Comment 4•3 months ago
|
||
The image size chosen in WordPress.
| Reporter | ||
Comment 5•3 months ago
|
||
What is strange is that only this image seems to be badly displayed.
Comment 6•3 months ago
|
||
Hi, thanks for filing.
So, we started supporting contain-sizes="auto" for <img> as of 152, as part of bug 2035864 - This is a standards-conforming feature, so this is (Unfortunately for this case) expected.
I see that for the badly sized photo, there is sizes="auto, (max-width: 335px) 100vw, 335px". Since sizes=auto is there, it triggers size containment, and we look at the contain-intrinsic-size for the image to figure out what the image size is supposed to be. The site specifies:
img:is([sizes="auto" i], [sizes^="auto," i]) {
contain-intrinsic-size: 3000px 1500px;
}
So the site tells Firefox that the image is supposed to be that big, so we end up sizing it as closely to it as possible, which causes the image to be zoomed to the width of the container.
I see that the photo right above the badly displayed one in fact doesn't have auto, and it sidesteps this problem. A bunch of other pictures have auto in them, but they end up being sized closely to the intended size, so they don't get zoomed in.
So I think the solution here is to remove any occurrence of auto in the sizes attribute for <img>.
| Reporter | ||
Comment 7•3 months ago
|
||
I think sizes="auto" is added by WordPress because I can only edit this code:
<a href="https://infolib.re/blog/wp-content/uploads/2023/12/Cable-PC-Terminal-Magelis.jpeg"><img class="aligncenter size-full wp-image-12162" src="https://infolib.re/blog/wp-content/uploads/2023/12/Cable-PC-Terminal-Magelis.jpeg" alt="Brochage du câble PC - Terminal Magelis" width="335" height="538" /></a>
I found this WordPress bug report, maybe it's related?
https://core.trac.wordpress.org/ticket/62515#comment:35
Comment 8•3 months ago
|
||
Yes, that seems like the exact problem.
Comment 9•3 months ago
|
||
Yeah this seems invalid, we're behaving correctly, and the same as other browsers. Seems this must be fixed on Wordpress' side.
Description
•