8000 [css-images] Layout of iframes with content intrinsic sizing that does not match the <iframe> · Issue #6817 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-images] Layout of iframes with content intrinsic sizing that does not match the <iframe> #6817

@chrishtr

Description

@chrishtr

Right now, an <iframe> element's content will always have an intrinsic sizing (otherwise known as the viewport of the iframe) that matches the <iframe>: if the <iframe>'s layout size changes, then the viewport bounds of the iframe document are adjusted accordingly, and the child-document receives a new layout.

Two upcoming features will change this situation:

  1. Auto-resizing iframes [css-sizing] Auto-resize iframes based on content #1771. There are modes in this proposal where the iframe could specify a fixed intrinsic sizing.
  2. Fenced frames. These are iframes that are privacy-preserving, so once they load their contents cannot change size (or else there would be a communication channel to the parent frame via resize patterns).

I propose that for such situations, we apply the usual replaced element semantics, with object-fit specifying how the contents are scaled and positioned within the rendering of the iframe. By default, object-fit: contain should apply, which will letterbox the iframe content.

A polyfill demo demonstrating the rendering behavior is here. The demo simulates a fencedframe, which when loaded freezes its size (try resizing with the resizer at the bottom-right).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0