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 25889 - <img> When to swap the image for the environment changes case
Summary: <img> When to swap the image for the environment changes case
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other All
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-27 06:40 UTC by contributor
Modified: 2019-03-29 20:59 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2014-05-27 06:40:55 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html
Multipage: http://www.whatwg.org/C#img-determine-type
Complete: http://www.whatwg.org/c#img-determine-type
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
<img> When to swap the image for the environment changes case
"wait for the fetch algorithm to queue its last task" means we wait until the
whole image has been downloaded, then swap.

* Do we want to swap if the image is in a supported format but is broken?
* Do we want to wait until the image has been decoded? (fully or partially?)
* Do we want to swap before the image has been completely downloaded (like
dynamically changing "src" swaps when dimensions are known)?

Posted from: 90.230.218.37 by simonp@opera.com
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.86 Safari/537.36 OPR/22.0.1471.16 (Edition Next)
Comment 1 Ian 'Hixie' Hickson 2014-05-28 22:16:19 UTC
IMHO you never want to switch to a broken image if you have a working one. Lower or higher resolution that ideal, or wrong aspect ratio or whatever, is better than nothing. You could swap if you have an incrementally-loading JPEG and you've already decoded enough of it that you're at the resolution that is currently being rendered or better. However, I wouldn't swap if you just have half a sequentially encoded PNG, say. That would look ugly.
Comment 2 Simon Pieters 2014-06-19 09:35:22 UTC
Maybe the spec should invoke "update the image data" with a special flag that avoids destroying the image and avoids firing error event, in the environment changes case, instead of having its own algorithm?

Possibly also delay upgrading pending request to current request so that it doesn't regress image quality while the new image is loading.
Comment 3 Simon Pieters 2014-06-19 09:50:22 UTC
Maybe for 'x' and 'w' you want to wait until you have at least the same quality as the old image (if progressive, otherwise wait until completely available), but for art direction you want to swap when you have dimensions.

The spec could leave it up to the UA when to do the swap for the environment changes case.
Comment 4 Ian 'Hixie' Hickson 2014-06-20 21:22:33 UTC
Even for art cases, it's better to wait til you have enough data to not be more ugly.

Ideally you'd even cross-fade between them, rather than jump cut.
Comment 5 Simon Pieters 2014-10-15 08:40:02 UTC
https://github.com/ResponsiveImagesCG/picture-element/commit/c798686911c2bf9334899ac44e0e4a11fa000b19

Leaving open since this might need more tweaks still.
Comment 6 Domenic Denicola 2019-03-29 20:59:44 UTC
https://github.com/whatwg/html/issues/3709