W3C home > Mailing lists > Public > www-style@w3.org > October 2013

Re: Behavior of device-pixel-ratio under zoom

From: James Robinson <jamesr@google.com>
Date: Fri, 18 Oct 2013 12:29:01 -0700
Message-ID: <CAD73mdLRefv5Avtq_ds02dZAjHnUnEDO1F62-tfzXsDSZw0+PA@mail.gmail.com>
To: Simon Pieters <simonp@opera.com>
Cc: www-style <www-style@w3.org>, "Robert O'Callahan" <robert@ocallahan.org>
On Fri, Oct 18, 2013 at 1:27 AM, Simon Pieters <simonp@opera.com> wrote:

> On Thu, 17 Oct 2013 23:36:38 +0200, James Robinson <jamesr@google.com>
> wrote:
>  See http://dev.w3.org/csswg/cssom-****view/#resizing-viewports<http://dev.w3.org/csswg/cssom-**view/#resizing-viewports>
>>> <htt**p://dev.w3.org/csswg/cssom-**view/#resizing-viewports<http://dev.w3.org/csswg/cssom-view/#resizing-viewports>
>>> >
>> That's great, but I think you should also specify that the
>> width/height/devicePixelRatio all change in the same task that dispatches
>> the resize event so authors can't see an inconsistent combination.  I.e.
>> if
>> I'm at 100x100 @ page zoom of 1.0 and then invoke my browser's page zoom
>> UI
>> to go to a page zoom of 2.0 while the page is actively polling these
>> values, it should only ever see 100/100/1.0 until the resize event fires
>> at
>> which point it should only see 50/50/2.0.
> Why is it important for width/height/devicePixelRatio to not update until
> the resize event fires?

As a general principle, whenever there is a property change associated with
an event notifying the page of the change the property should be changed in
the same task that fires the event so that code that polls the property and
code that listens to the event always have the same view of the world.

In practice, implementations will generally behave this way without any
explicit text but it's important to put this down normatively so authors
can depend on it.

> Is it that scripts might assume that the page has responded to the change
> already if it sees a new value? Why is that a problem for devicePixelRatio
> but not for e.g. getComputedStyle?

getComputedStyle() should behave the same way.

- James

> --
> Simon Pieters
> Opera Software
Received on Friday, 18 October 2013 19:29:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:51:03 UTC