W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2012

Re: [whatwg] Problems with width/height descriptors in srcset

From: Kornel Lesiński <kornel@geekhood.net>
Date: Thu, 17 May 2012 19:42:01 +0100
To: whatwg@lists.whatwg.org
Message-ID: <op.wegt8bubte2ec8@aimac.local>
On Thu, 17 May 2012 19:15:36 +0100, Matthew Wilcox  
<mail@matthewwilcox.com> wrote:

> I also agree with Tab and Jeremy on this one - that makes a lot more
> sense to me and removes any ambiguity without being overly verbose.

I like the less-compressed, more CSSy syntax as well.

I have two concerns though:

Is any media query allowed?
If so, then use of "min-device-pixel-ratio:2x" would give inferior results  
to using the "2x" multiplier, because 2x allows UA to choose when the 2x  
image is selected (taking into account bandwidth, zoom, user preference,  
etc.), but min-device-pixel-ratio is supposed to query a fact about the  
device, not a preference. Should that be discouraged, or maybe even  
special-cased as an alias of "2x" descriptor?

How do scaling factors and size queries interact?

When only scaling factors are specified then selection is easy, and images  
could be described in any order:

<img srcset="imgA 1x, imgB 2x">
<img srcset="imgB 2x, imgA 1x">

If "first one that matches" rule was applied to density descriptors, then  
this would surprisingly fail:
<img srcset="imgA 1x, imgB 2x">

because a 2x screen can display 1x image (or the opposite case would fail  
depending how you define matching of density).

As soon as sizes are specified, taking into account order of the rules  
becomes unavoidable:

<img srcset="imgA min-height:100px, imgB min-width:100px">

on a screen that is larger than 100x100 both would match, so there needs  
to be some definition which one wins, e.g. the first one that matches.

<img srcset="imgA 1x min-height:100px, imgB 2x min-width:100px">

but can UA choose the second image in this case when it prefers 2x density?

i.e. is the rule going to be "first which matches at any density" or  
"first which matches at desired density, and failing that the first which  
matches at any other density"?

regards, Kornel Lesiński
Received on Thursday, 17 May 2012 18:42:39 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:42 UTC