This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20209 - “Art direction” use case not well supported by srcset
Summary: “Art direction” use case not well supported by srcset
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on: 20172
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-03 15:26 UTC by Marcos Caceres
Modified: 2013-09-16 17:57 UTC (History)
5 users (show)

See Also:


Attachments

Description Marcos Caceres 2012-12-03 15:26:52 UTC
+++ This bug was initially created as a clone of Bug #20172 +++

Although img@srcset supports the resolution matching use case in a limited way, it does not fully support the art direction use case. To support the the art direction use case, there needs to be some mechanism in place to force the browser to display a given image when condition is met. This is akin to the use case for CSS's !important rule.
(See: http://blog.cloudfour.com/a-framework-for-discussing-responsive-images-solutions/ )
For detailed description of use case, see also: http://usecases.responsiveimages.org/#art-direction
Comment 1 Ian 'Hixie' Hickson 2012-12-07 23:04:12 UTC
I don't understand. Authors can never force browsers to do anything. Are you just referring to the part of the spec that allows browsers to not replace the image if they have reason not to? (e.g. if the user has told the browser to stop updating the images, or if the user has gone offline, or if the user is on a metered connection, or some such?) I don't think we can change that... even !important doesn't override the user's choices.

If I'm missing something, please reopen the bug, explaining what you mean by "force".
Comment 2 Marcos Caceres 2012-12-10 14:50:27 UTC
sorry, force was not a good word to use. Perhaps "strongly hint". Anyway, I think it's pretty clear you know what I mean. I agree that the author should not override the user's choices.
Comment 3 Yoav Weiss 2012-12-26 16:26:34 UTC
From the use-cases document[1]:
[[
In a responsive design, it is typical to change an image so it can be targeted towards the features of a particular display (or set of displays). Sometimes this means cropping an image. Other times, it can mean a new form of an image that may have different proportions or may be changed in other ways to match changes in the layout. 
  
    On large screens, a large image (e.g., an object or person with a broad background) is shown.

    On smaller screens, shrinking the image can reduce its relevance, usefulness, and legibility.

]]

Therefore, by "art-direction" we mean “a method by which authors can specify image sources with differing cropping and zooming, to better focus on the image’s subject matter in a wide range of layouts/screen sizes.

Currently the `srcset` syntax does not enable to distinguish between:
* Different resolution image sources: Several images which only difference between them is the resolution & possibly the compression level.
* Art-directed image sources: Several images which are modified versions of the original images (usually cropped versions)

For different resolution image sources, browsers can heuristically decide (according the bandwidth conditions, user preference, etc) which version to download. The user will get the same content, with the only difference being less attractive images. Furthermore, if the browser had previously downloaded a high resolution version of these resources, it can heuristically decide not to download a low resolution version if the conditions changed (e.g. viewport was downsized), and simply resize its existing image resource.

For the art-directed image sources, browsers should always strive to download and display the image specified by the author. Otherwise, the user experience may be harmed. The web designer would assume that at a particular breakpoint their carefully crafted version of the image will be used, but current srcset logic says that the browser could choose to use a different version for the reasons explained above. This could result in the browser choosing an image source that’s inappropriately sized to the page/layout. For example, this could lead to the selection of an image source with an inherent size of a few hundred pixels—the source intended for display in a “mobile” layout—on a desktop display. If allowed to rely on its inherent size, this will result in a layout-inappropriate image. If the developer has specified that the image should always occupy the full width of its parent container (`width: 100%`), the image source would become too distorted to be of any use.
Furthermore, the art-direction use case could allow the image's proportions to change in concert with the page's layout changes, as triggered by media queries in CSS. The browser would need to request and display these assets without applying heuristics that may (and probably should) only be applied to the different resolution image sources, lest the page layout break and possibly become unusable.

[1] http://usecases.responsiveimages.org/#art-direction
Comment 4 Ian 'Hixie' Hickson 2012-12-30 05:48:15 UTC
By the definitions in comment 3, the bug should really be "only the art direction use case is well supported". The spec allows browsers to not download images if different ones apply, but it doesn't recommend it. A full implementation would always be downloading the images when the conditions changed.

I'm marking this WORKSFORME for now, but if when it's implemented it turns out that browsers in fact don't download the images sufficiently often when things change to satisfy the "art" use case, then please file a bug again (or send e-mail feedback) so that we can add a feature to make browsers more likely to do it. My expectation is that browsers that implement this will do it sufficiently well for the art case to be handled fine.