cooperatively-sized-iframes icon indicating copy to clipboard operation
cooperatively-sized-iframes copied to clipboard

Also allow letterboxing

Open domenic opened this issue 4 years ago • 1 comments

The current proposal is that, if the framed content requests a given size and the parent frame constrains or ignores it, the resulting iframe's size, and the resulting viewport inside the iframe, are determined by the parent.

This is probably the right default model, but @chrishtr suggests another one might sometimes be desired: decoupling the inside-viewport size from the iframe's size. That is, the parent retains full control over the iframe element, but the framed content gets to control its viewport size. The result is then letterboxed as appropriate. (Like object-fit: contain.)

Example:

  • Parent says contain-intrinsic-width: 500px; contain-intrinsic-height: from-element; max-height: 800px;
  • Iframe says requestedwidth="600" requestedheight="900"
  • Result:
    • The <iframe> is 500x800
    • The viewport inside the iframe is 600x900
    • The result is the iframe contents are displayed in a 500x750 box, scaled down as appropriate from the original 600x900 pixels, with 25px on the top and bottom.

Questions:

  • How to trigger this mode? Does the outer page trigger it? Does the inner page? Either? Both?
  • How to control the background color of the letterbox? I think the natural answer is the background color of the <html> element inside the iframe but we should double-check.
  • Would other modes besides object-fit: contain behavior make sense?

domenic avatar Nov 29 '21 18:11 domenic

Related: w3c/csswg-drafts#6817

chrishtr avatar Nov 29 '21 18:11 chrishtr