[webkit-dev] Device and page scaling

Dana Jansens danakj at chromium.org
Tue May 29 19:20:24 PDT 2012


On Tue, May 29, 2012 at 9:54 PM, Adam Barth <abarth at webkit.org> wrote:

> There's a lot of confusion in the code base about how page and device
> scaling works.  Different ports are using Page::deviceScaleFactor for
> incompatible purposes.  On Mac, Page::deviceScaleFactor represents the
> actual scaling factor of the physical device.  It can change over time
> because a given Page might be displayed on different devices over its
> lifetime (e.g., if there are multiple monitors).  On Chromium and Qt,
> Page::deviceScaleFactor starts off as the actual scaling factor of the
> physical device, but it can change over time if a web page has a
> viewport meta tag that contains a target-densitydpi directive.
>
> There's also Settings::defaultDeviceScaleFactor, which represents the
> actual scaling factor of the physical device on ports that adjust
> Page::deviceScaleFactor based on the target-densitydpi directive.
> Settings::defaultDeviceScaleFactor does not work on Mac (and can't
> work because of multimon).
>
> Here's a proposal for making sense out of this mess:
>
> == Page::pageScaleFactor ==
>
> Page::pageScaleFactor is a scaling factor that arises from the meta
> viewport tag and from "pinch-to-zoom" interactions.  This proposal
> doesn't change anything about page scaling.
>
> == Page::deviceScaleFactor ==
>
> Page::deviceScaleFactor is the scaling factor of the actual physical
> device.  It's value changes when the physical device displaying the
> Page changes its scaling factor.  It is not affected by
> target-densitydpi or anything else unrelated to the physical device.
>
> == Page::effectiveDeviceScaleFactor ==
>
> Page::effectiveDeviceScaleFactor starts off as matching
> Page::deviceScaleFactor but changes to reflect any target-densitydpi
> directives.  It's unclear to me how Page::effectiveDeviceScaleFactor
> should react when the underlying physical device changes its scaling
> factor.  Currently, that shouldn't occur, so I'm inclined to add an
> ASSERT and worry about it later.
>
> == Settings::defaultDeviceScaleFactor ==
>
> This variable will be deleted.
>
> Thoughts?
>

Thanks for starting this discussion.

The other difference between ports or platforms is how deviceScaleFactor is
applied. It can be applied by being multiplied into pageScaleFactor, or it
could be applied separately as a post-processing/compositing property, or
potentially other ways. Did you have thoughts on that? You say
pageScaleFactor is unchanged, but I think it would be nice to separate
these two things more distinctly, then combine them more explicitly where
appropriate.

- Dana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120529/0a212c09/attachment.html>


More information about the webkit-dev mailing list