NEW 149899
Responsive images (srcset, sizes, w) don't load higher resolution when viewport is enlarged.
https://bugs.webkit.org/show_bug.cgi?id=149899
Summary Responsive images (srcset, sizes, w) don't load higher resolution when viewpo...
Duncan Wilcox
Reported 2015-10-07 14:46:22 PDT
Created attachment 262646 [details] testcase The attached test case defines a 100% size image. The srcset attribute indicates different resolution images to be loaded. The sizes attribute indicates the image is going to be 100% of the viewport size. The test case file should be opened after the browser window has been made as narrow as possible, or reloading the page after having made the browser window as narrow as possible. This ensures the browser starts with the smallest size image it needs. The placeholder images (sourced from placehold.it) show the image size. The initial image is typically 800 pixels on a retina Mac, with the Safari window as narrow as possible, as indicated by the "800w" text in the image. The expected behavior is for the image to be reloaded when the viewport size changes, so making the browser window wider should show a new text, such as 1000w or 1200w, and so on. The actual behavior in Safari 9 is no new image is ever loaded, until the whole page is reloaded. The current version of Chrome (45....) properly loads larger images. While this is under- or un-specified in the relevant spec (https://html.spec.whatwg.org/multipage/embedded-content.html) the sensible approach is to load proper assets for the current viewport. Otherwise images will appear fuzzy or pixellated. On the desktop the switch can be dramatic (perhaps 400 to 1200+), but even on mobile a portrait/landscape rotation can almost double the required image size, and a split screen 320 pixel wide mobile safari can become a 1000+ pixel wide full screen browser.
Attachments
testcase (645 bytes, text/html)
2015-10-07 14:46 PDT, Duncan Wilcox
no flags
Yoav Weiss
Comment 1 2015-10-08 00:20:58 PDT
Switching resources when the viewport changes have not yet been implemented. This behavior is not specified on purpose, leaving UAs to do what they see fit, which means that current behavior is spec compliant. With that said, I believe we should implement such dynamic loading, for the reasons you stated.
Moritz Mahringer
Comment 2 2020-04-23 16:39:18 PDT
This is still a problem. We have to add an event listener to manually change the srcSet attribute to make it reevaluate. Chrome correctly automatically updates to a larger size on resize.
Radar WebKit Bug Importer
Comment 3 2020-04-24 09:25:59 PDT
Note You need to log in before you can comment on or make changes to this bug.