Re: [visualViewport]: Proposal and RFC

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?

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`?

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).

[1] http://tanalin.com/en/projects/smart-upscale/

Received on Wednesday, 7 September 2016 00:44:34 UTC