[csswg-drafts] [cssom-view] Visual viewport's scale factor in iframe (#8434)

upsuper has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Visual viewport's scale factor in iframe ==
When a user pinch-zoom a page, the scale factor can be accessed via `visualViewport.scale`. However, such information is not available within `<iframe>`. `visualViewport.scale` consistently returns `1` among all browsers I tested, and it doesn't seem to be clarified explicitly in the spec. In addition, if the page in `<iframe>` and outside are not in the same origin, accessing to `parent.visualViewport` is restricted.

It would be good to make it possible for pages inside `<iframe>` to have access to such scale factor, as well as allowing to listen to the event that informs its change. It could potentially be done either by
* making `visualViewport.scale` always refer the top level scale factor, or
* making `parent.visualViewport` (or part of it) accessible even across origin.

I don't think enabling accessing this scale factor leaks much information across origins.

For context, we have logic to pick image based on the rendering size of it on the screen. However, when a user embeds our page in a small `<iframe>` within their own page (especially when such page is viewed on a mobile device), we may pick a very small image to show for performance reason (traffic, memory, etc.). When the viewer pinch-zoom to look at the details, we are unable to automatically swap in a larger image because we are not aware of the scale change, and as a result, they may see pixelated image.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8434 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 9 February 2023 02:33:24 UTC