[webkit-dev] Device and page scaling

Konrad Piascik kpiascik at rim.com
Fri Jun 1 09:15:42 PDT 2012


Reposting comment from Bug 88047

After discussing this internally we believe that while the current implementation of target-densitydpi is not ideal it's ability to allow you scale your viewport to a given target density as well as to allow you to not scale (deviceDPI) are both desired features of this API that we'd like to have available to developers.

This is useful for 2 cases:
1) automatically scaling content to the AutoValue (ie 160) DPI, which is what most mobile optimized sites do
2) allowing the user to have pixel perfect rendering on a given device.

-Konrad
________________________________________
From: webkit-dev-bounces at lists.webkit.org [webkit-dev-bounces at lists.webkit.org] on behalf of Adam Barth [abarth at webkit.org]
Sent: Friday, June 01, 2012 2:21 AM
To: Maciej Stachowiak
Cc: kenneth at webkit.org; webkit-dev at lists.webkit.org
Subject: Re: [webkit-dev] Device and page scaling

I've posted a patch to remove target-densitydpi:

https://bugs.webkit.org/show_bug.cgi?id=88047

There's some concern that target-densitydpi is used by some apps that
are bundled with Android, but folks appear willing to deprecate the
feature and to migrate those apps to using other mechanisms, such as
responsive images and CSS device units.

Once that patch lands, I'll start to unwind the complexity introduced
by the feature.

Thanks,
Adam


On Wed, May 30, 2012 at 7:57 PM, Maciej Stachowiak <mjs at apple.com> wrote:
>
> On May 30, 2012, at 4:24 PM, John Mellor <johnme at chromium.org> 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
webkit-dev at lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.


More information about the webkit-dev mailing list