Bug 149899 - Responsive images (srcset, sizes, w) don't load higher resolution when viewport is enlarged.
Summary: Responsive images (srcset, sizes, w) don't load higher resolution when viewpo...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: Safari 9
Hardware: Mac OS X 10.11
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2015-10-07 14:46 PDT by Duncan Wilcox
Modified: 2023-02-25 17:39 PST (History)
10 users (show)

See Also:


Attachments
testcase (645 bytes, text/html)
2015-10-07 14:46 PDT, Duncan Wilcox
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Wilcox 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.
Comment 1 Yoav Weiss 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.
Comment 2 Moritz Mahringer 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.
Comment 3 Radar WebKit Bug Importer 2020-04-24 09:25:59 PDT
<rdar://problem/62318091>