Skip to content

Commit 42f5ae0

Browse files
authored
[css-sizing-4] Add the frame-sizing property (#13701)
* Move Responsively-sized iframes section to Section 5.3 * Define frame-sizing and add meta tag immutability * Update the `meta` condition for `requestResize` * Removed an obsolete issue
1 parent 9156204 commit 42f5ae0

File tree

1 file changed

+85
-78
lines changed

1 file changed

+85
-78
lines changed

css-sizing-4/Overview.bs

Lines changed: 85 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
891891

892892
<pre class=propdef>
893893
Name: contain-intrinsic-width, contain-intrinsic-height, contain-intrinsic-block-size, contain-intrinsic-inline-size
894-
Value: [ auto | from-element ]? [ none | <<length [0,∞]>> ]
894+
Value: auto? [ none | <<length [0,∞]>> ]
895895
Initial: none
896896
Inherited: no
897897
Logical property group: contain-intrinsic-size
@@ -989,22 +989,6 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
989989
<wpt pathprefix="css/css-contain/">
990990
content-visibility/content-visibility-058.html
991991
</wpt>
992-
993-
: <dfn>from-element</dfn>
994-
:: If ''contain-intrinsic-size/from-element'' is specified
995-
and the element is a [=replaced element=]
996-
with an [=internal layout intrinsic size=],
997-
its [=explicit intrinsic inner size=] in the corresponding axis
998-
is that size.
999-
1000-
Note: Whether a [=replaced element=]
1001-
has an [=internal layout intrinsic size=]
1002-
is defined by the [=document language=].
1003-
In HTML, only <{iframe}>s do so.
1004-
1005-
Issue: Should this apply even when ''contain:layout'' isn't specified?
1006-
1007-
Issue: The name needs further discussion.
1008992
</dl>
1009993

1010994
If an element has an [=explicit intrinsic inner size=] in an axis,
@@ -1032,7 +1016,7 @@ Overriding Contained Intrinsic Sizes: the 'contain-intrinsic-*' properties</h3>
10321016

10331017
<pre class="propdef shorthand">
10341018
Name: contain-intrinsic-size
1035-
Value: [ [ auto | from-element ]? [ none | <<length [0,∞]>> ] ]{1,2}
1019+
Value: [ auto? [ none | <<length [0,∞]>> ] ]{1,2}
10361020
</pre>
10371021

10381022
<wpt>
@@ -1108,66 +1092,6 @@ Last Remembered Size</h4>
11081092
contain-intrinsic-size/auto-013.html
11091093
</wpt>
11101094

1111-
<h4 id='responsive-iframes' dfn lt="responsively-sized iframe" export>
1112-
Responsively-sized iframes</h4>
1113-
1114-
Some [=replaced elements=] can contain "normal" flowed content,
1115-
such as HTML <{iframe}>s.
1116-
For privacy and security reasons,
1117-
these elements do not, by default,
1118-
expose any information about their internal contents' sizing
1119-
to the outside page,
1120-
instead just using a static, predetermined intrinsic size,
1121-
and making their contents scrollable.
1122-
The ''contain-intrinsic-size/from-element'' value of 'contain-intrinsic-size'
1123-
allows these elements to opt into exposing their actual content size,
1124-
known as their <dfn export>internal layout intrinsic size</dfn>.
1125-
1126-
Which elements have an [=internal layout intrinsic size=],
1127-
and how it's determined,
1128-
are decided by the [=document language=].
1129-
In HTML, only <{iframe}> elements can have an [=internal layout intrinsic size=],
1130-
and further,
1131-
only when the contained document has also opted in
1132-
via a <code>&lt;meta name=responsize-embedded-sizing></code> element.
1133-
1134-
An <{iframe}> initially doesn't have an [=internal layout intrinsic size=].
1135-
When an <{iframe}>'s internal document is loaded,
1136-
if the required <{meta}> element is present
1137-
at the time of the <code>DOMContentLoaded</code> and <code>load</code> events,
1138-
the <{iframe}>'s [=internal layout intrinsic size=]'s height
1139-
is set to the [=natural height=] of the embedded document.
1140-
Subsequent changes to content, styling or layout of the embedded document
1141-
do not affect the [=internal layout intrinsic size=].
1142-
1143-
<div class='example'>
1144-
When the embedded document has the following HTML:
1145-
1146-
<xmp highlight=html>
1147-
<meta name="responsive-embedded-sizing">
1148-
<div style="height: 500px"></div>
1149-
</xmp>
1150-
1151-
and the embedding document has the following CSS:
1152-
1153-
<pre highlight=css>
1154-
iframe {
1155-
contain-intrinsic-block-size: from-element 150px;
1156-
}
1157-
</pre>
1158-
1159-
The height of the <{iframe}> will initially be ''150px'',
1160-
but will be updated to ''500px'' once the iframe's document loads.
1161-
</div>
1162-
1163-
In addition,
1164-
the internal document can call {{window/requestResize()|window.requestResize()}};
1165-
if the document still has the required <{meta}> element,
1166-
its [=internal layout intrinsic size=]'s height
1167-
is updated to its new current [=natural height=].
1168-
1169-
Note: If the required <{meta}> element is not present,
1170-
the call throws a {{NotAllowedError}} {{DOMException}} instead.
11711095

11721096
<h4 id='cis-scrollbars'>
11731097
Interaction With ''overflow: auto''</h4>
@@ -1257,6 +1181,89 @@ Interaction With ''overflow: auto''</h4>
12571181
███▌ ███▌ █▌ ▐▌ █▌ █▌ █▌ ████ ████▌ ███▌
12581182
-->
12591183

1184+
<h3 id='responsive-iframes' dfn lt="responsively-sized iframe" export>
1185+
Responsively-sized iframes: the 'frame-sizing' property</h3>
1186+
1187+
<pre class="propdef">
1188+
Name: frame-sizing
1189+
Value: auto | content-width | content-height | content-block-size | content-inline-size
1190+
Initial: auto
1191+
Applies to: <{iframe}> elements
1192+
Inherited: no
1193+
Computed value: specified keyword
1194+
Animation type: discrete
1195+
</pre>
1196+
1197+
Some [=replaced elements=] can contain "normal" flowed content,
1198+
such as HTML <{iframe}>s.
1199+
For privacy and security reasons,
1200+
these elements do not, by default,
1201+
expose any information about their internal contents' sizing
1202+
to the outside page,
1203+
instead just using a static, predetermined intrinsic size,
1204+
and making their contents scrollable.
1205+
The 'frame-sizing' property
1206+
allows these elements to opt into exposing their actual content size,
1207+
known as their <dfn export>internal layout intrinsic size</dfn>.
1208+
1209+
Which elements have an [=internal layout intrinsic size=],
1210+
and how it's determined,
1211+
are decided by the [=document language=].
1212+
In HTML, only <{iframe}> elements can have an [=internal layout intrinsic size=],
1213+
and further,
1214+
only when the contained document has also opted in
1215+
via a <code>&lt;meta name=responsive-embedded-sizing></code> element.
1216+
1217+
The first instance of this meta tag added by the parser can make it opt in.
1218+
If the parser encounters multiple such tags, only the first one is used.
1219+
If the parser closes the <code>&lt;head&gt;</code> without seeing the tag,
1220+
it is frozen as not-set.
1221+
1222+
An <{iframe}> initially doesn't have an [=internal layout intrinsic size=].
1223+
When an <{iframe}>'s internal document is loaded,
1224+
if the required <{meta}> element is present,
1225+
the <{iframe}>'s [=internal layout intrinsic size=]'s height or width
1226+
is set to the [=natural size=] of the embedded document as specified by 'frame-sizing'.
1227+
Resizing occurs at the <code>DOMContentLoaded</code> and <code>load</code> events.
1228+
Subsequent changes to content, styling or layout of the embedded document
1229+
do not affect the [=internal layout intrinsic size=].
1230+
1231+
When laying out the <{iframe}>'s internal document,
1232+
its initial containing block size is locked to
1233+
the size at the time of its first layout,
1234+
to mitigate the risks of layout loops and information leaks.
1235+
1236+
<div class='example'>
1237+
When the embedded document has the following HTML:
1238+
1239+
<xmp highlight=html>
1240+
<meta name="responsive-embedded-sizing">
1241+
<div style="height: 500px"></div>
1242+
</xmp>
1243+
1244+
and the embedding document has the following CSS:
1245+
1246+
<pre highlight=css>
1247+
iframe {
1248+
frame-sizing: content-height;
1249+
}
1250+
</pre>
1251+
1252+
The height of the <{iframe}> will initially be the default iframe height (typically ''150px''),
1253+
but will be updated to ''500px'' once the iframe's document loads.
1254+
</div>
1255+
1256+
In addition,
1257+
the internal document can call {{window/requestResize()|window.requestResize()}};
1258+
if the document has the required <{meta}> element
1259+
at the time of parsing as described above,
1260+
its [=internal layout intrinsic size=]
1261+
is updated to its new current [=natural size=].
1262+
1263+
Note: If the required <{meta}> element is not present,
1264+
the call throws a {{NotAllowedError}} {{DOMException}} instead.
1265+
1266+
12601267
<h3 id="intrinsic-contribution">
12611268
Intrinsic Size Contributions</h3>
12621269

0 commit comments

Comments
 (0)