- From: Yash Malik <ymalik@google.com>
- Date: Wed, 07 Sep 2016 14:27:23 +0000
- To: Marat Tanalin <mtanalin@yandex.ru>, David Bokan <bokan@google.com>, "www-style@w3.org" <www-style@w3.org>
- Message-ID: <CANZmQyZSuwWeyi1xGrHrHwwpv+nu9_D6eXyhYe1ARC6CG-fUGg@mail.gmail.com>
See inline replies On Tue, Sep 6, 2016 at 8:44 PM Marat Tanalin <mtanalin@yandex.ru> wrote: > 10.08.2016, 19:36, "David Bokan" <bokan@google.com>: > > We've been working on the proposal for a visual viewport API at > https://github.com/WICG/ViewportAPI. We (Chrome) would like to ship this > feature in the nearish future but I'd like to make sure we have consensus > that this is a good idea and the current state of the proposal is > acceptable before we do so. > > There is certainly a need for a consistent, reliable, and straightforward > visual-viewport API for applications that dealing with physical pixels is > crucial for, especially for webtech-based extensions like those powered by > the WebExtensions API. > > As an author of the SmartUpscale [1] extension intended for disabling blur > solely for images displayed at integer zoom levels in strong direct > relation to _physical_ pixels, I am specifically interested in the proposed > `window.visualViewport.scale` property (as well as an event to track its > changes) as a legitimate way to determine pinch-zoom level instead of dirty > unreliable workarounds like `window.outerWidth / window.innerWidth` we are > currently forced to use for this purpose (or even more impressive > dummy-iframe-based approach used in your polyfill). > > Do I understand correctly that the `window.visualViewport.scale` property: > > 1. is supposed to be available and functional always, regardless of > whether there is a viewport meta element on the page? > Yes, this will be always be available and functional, regardless of the viewport meta tag. > 2. contains zoom relative to that already reflected in > `window.devicePixelRatio`, so the total physical-pixels-per-logical-pixel > ratio can be calculated as the _product_ of `window.visualViewport.scale` > times `window.devicePixelRatio`? > By physical-pixels-per-logical-pixel, do you mean physical-pixels-per-css-pixels? If so, then almost*. `window.visualViewport.scale` times `window.devicePixelRatio` doesn't take the browser zoom into account. See this <https://www.chromium.org/developers/design-documents/blink-coordinate-spaces> page for more info on the coordinate spaces. > Also, while this is somewhat implicitly clear from the "viewport's width > or height is changed" phrase, the Visual Viewport API spec would probably > get more clear if the description of conditions when the `resize` event > should fire did include an explicit clarification that the `resize` event > fires once the `window.visualViewport.scale` property is changed (due to > e.g. pinch-zoom). > > You're right. Will add that to the spec. Thanks :) > [1] http://tanalin.com/en/projects/smart-upscale/ >
Received on Wednesday, 7 September 2016 14:32:50 UTC