REOPENED295203
object-fit: scale-down is ignored when srcset attribute and w descriptor is used
https://bugs.webkit.org/show_bug.cgi?id=295203
Summary object-fit: scale-down is ignored when srcset attribute and w descriptor is used
terka.codes
Reported 2025-06-30 06:31:18 PDT
Steps to reproduce the problem: Open url https://codepen.io/zipper/pen/vdwVLb Image inside first div is incorrectly scaled. Similar behaviour is observed when sizes attribute is used https://codepen.io/zipper/pen/gvJBdp. Actual results: Image is up-scaled. Its size is either corresponding to sizes attribute or viewport width (when sizes is omitted). But source image is smaller and because of "object-fit: scale-down" it shouldn't be upscaled. Expected results: My understanding is, that sizes attribute should describe available space (and reserved space for the image), but then the image size is described using its descriptor in srcset. And then the object-fit comes to play, therefore the image should be 400px wide, since it has "object-fit" property set to "scale-down". In the second example, the first image should be 200px wide. Second image is correctly smaller regardless the sizes. Related issues: Reported bug in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1974747 Fixes issue in Chrome: https://issues.chromium.org/issues/41374573
Attachments
rendering in safari, firefox, chrome (1.57 MB, image/png)
2025-07-01 23:12 PDT, Karl Dubost
no flags
Radar WebKit Bug Importer
Comment 1 2025-06-30 11:08:36 PDT
Karl Dubost
Comment 2 2025-07-01 23:12:21 PDT
Created attachment 475738 [details] rendering in safari, firefox, chrome
Ahmad Saleem
Comment 3 2025-07-02 02:26:27 PDT
Does Firefox regressed? Since Chromium / Blink commit claims - 'Chrome's behavior now matches Firefox.' while image attached by Karl shows that Safari is matching Firefox.
Ahmad Saleem
Comment 4 2025-07-02 02:41:17 PDT
Radek Šerý
Comment 5 2025-07-02 03:07:19 PDT
Yes, I think the Firefox regressed, I have already submitted an issue there https://bugzilla.mozilla.org/show_bug.cgi?id=1974747.
Ahmad Saleem
Comment 6 2025-07-02 03:08:59 PDT
(In reply to Radek Šerý from comment #5) > Yes, I think the Firefox regressed, I have already submitted an issue there > https://bugzilla.mozilla.org/show_bug.cgi?id=1974747. Thanks for confirming, I already did PR and will wait for review.
EWS
Comment 7 2025-07-02 09:43:49 PDT
Committed 296914@main (ec4f65f46d45): <https://commits.webkit.org/296914@main> Reviewed commits have been landed. Closing PR #47479 and removing active labels.
WebKit Commit Bot
Comment 8 2025-07-02 10:47:41 PDT
Re-opened since this is blocked by bug 295344
Radek Šerý
Comment 9 2025-07-07 01:29:14 PDT
FYI similar issue in FF has been closed as invalid. Which is technically correct - the reported bug is actually strictly speaking not a bug, although very unexpected behaviour from developer point of view. I have opened an issue on WHATWG to see if there is a will to change the spec https://github.com/whatwg/html/issues/11428. Feel free to express your opinion there, thank you.
Note You need to log in before you can comment on or make changes to this bug.