[webkit-dev] Device and page scaling

John Mellor johnme at chromium.org
Fri Jun 1 11:41:54 PDT 2012

> 1) automatically scaling content to the AutoValue (ie 160) DPI, which is
what most mobile optimized sites do

All WebKit-based mobile browsers I've met do target-densityDpi=auto by
default, and resolve auto as 160 (and if they don't use 160, they probably
have good reasons for it like expecting the device to be used at unusually
short or long reading distances -- see wkbug.com/88114 -- in which case the
web page should generally respect that). So there should be no need to
specify this explicitly.

> 2) allowing the user to have pixel perfect rendering on a given device.

Yes, this is the main use case the feature had in mind. Though it's a lot
of work to actually use as you have to then manually multiply all your font
sizes, dimensions, etc by window.devicePixelRatio (and in practice you need
to maintain a completely different set of css for browsers which don't
support target-densityDpi). Is there significant value-add over what you
can achieve with high resolution images (srcset, image-set) and device
units in CSS / subpixel rendering?


On Fri, Jun 1, 2012 at 5:15 PM, Konrad Piascik <kpiascik at rim.com> wrote:

> 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.
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120601/035e41f2/attachment.html>

More information about the webkit-dev mailing list