On May 30, 2012, at 4:24 PM, John Mellor <[email protected]> wrote:

> 
> Maciej Stachowiak wrote:
> > Can you explain why the target-densitydpi feature even exists? It
> > seems ill-conceived to me, and the most straightforward fix would
> > be to remove it. I have not heard anyone explain the use case for
> > it. (I'm also not clear on the details of what it actually does, and
> > neither the name nor the docs are enlightening.)
> 
> Designers who insist on pixel-perfect rendering can use "width=device-width, 
> target-densityDpi=device-dpi" to make their site render at one CSS pixel per 
> screen pixel, letting you get crisp non-scaled borders etc. It does however 
> require the designer to manually adjust dimensions and font-sizes to 
> compensate for the dpi using window.devicePixelRatio, which is incredibly 
> onerous (especially in a cross-platform design, which must look the same on 
> devices that don't support target-densityDpi, hence everything needs to be 
> implemented twice).
> 
> That's the main use case, though it's pretty niche (if you want pixel-perfect 
> UI, it's generally less hassle to just use high resolution images and scale 
> them down). The other values I don't know of any compelling use cases for; 
> I'll talk to the engineer who first added this and see if they have any good 
> ones.

It seems to me that you could better address this use case by supporting 
fractional CSS pixels, which hopefully our new subpixel layout code can enable. 
The tricky thing about "target-densityDpi=device-dpi" is that it forces you to 
sniff the device pixel ratio and change pretty much all your layout based on 
it. If historically it would actually alter what is reported for 
devicePixelRatio, then it would be pretty hard to make a site design that looks 
right on both 1x and 2x devices with "target-densityDpi=device-dpi. So I'm 
skeptical that anyone has made good use of it.

> 
> I don't know whether or not we can remove it (would need to check how popular 
> it is), but it might be possible to deprecate it (recommend against using 
> it). That's probably something we should discuss on www-style rather than 
> here.

I guess that would be the right place to discuss dropping it from the spec, but 
it seems like here is the right place to discuss dropping it from the 
implementation. From comments in the CSS Device Adaptation spec, it seems like 
it was only added because it was in Android.

Regards,
Maciej

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to