@@ -150,16 +150,19 @@ Box Tree Transformations {#layout-api-box-tree}
150150-----------------------------------------------
151151
152152The <a>layout API children</a> can act in different ways depending on the value of <a for="document
153- layout definition">child display</a> (set by <code> childDisplay</code> on the class).
153+ layout definition">layout options</a> ' {{LayoutOptions/childDisplay}} (set by
154+ <code> layoutOptions</code> on the class).
154155
155- If the value of <a for="document layout definition">child display</a> is <code> "block"</code> the
156- 'display' value of that child is <a>blockified</a> . This is similar to children of <a>flex
157- containers</a> or <a>grid containers</a> . See [[!css3-display]] .
156+ If the value of <a for="document layout definition">layout options</a> '
157+ {{LayoutOptions/childDisplay}} is <code> "block"</code> the 'display' value of that child is
158+ <a>blockified</a> . This is similar to children of <a>flex containers</a> or <a>grid containers</a> .
159+ See [[!css3-display]] .
158160
159- If the value of <a for="document layout definition">child display</a> is <code> "normal"</code> , no
160- <a>blockification</a> occurs. Instead children with a <<display-outside>> <a>computed value</a> of
161- ''inline'' (a <a>root inline box</a> ) will produce a single {{Fragment}} representing each line when
162- {{LayoutChild/layoutNextFragment()}} is called.
161+ If the value of <a for="document layout definition">layout options</a> '
162+ {{LayoutOptions/childDisplay}} is <code> "normal"</code> , no <a>blockification</a> occurs. Instead
163+ children with a <<display-outside>> <a>computed value</a> of ''inline'' (a <a>root inline box</a> )
164+ will produce a single {{Fragment}} representing each line when {{LayoutChild/layoutNextFragment()}}
165+ is called.
163166
164167Note: This allows authors to adjust the available inline size of each line, and position each line
165168 separately.
@@ -566,8 +569,8 @@ enum BreakType { "none", "line", "column", "page", "region" };
566569A {{LayoutChild}} can produce multiple {{Fragment}} s. A {{LayoutChild}} may fragment in the block
567570direction if a {{LayoutConstraints/blockFragmentationType}} is not none. Additionally
568571{{LayoutChild}} which represents <a>inline-level</a> content, may fragment line by line if the
569- <a for="document layout definition">child display </a> (set by <code> childDisplay </code> ) is
570- <code> "normal"</code> .
572+ <a for="document layout definition">layout options </a> ' {{LayoutOptions/childDisplay}} (set by
573+ <code> layoutOptions </code> ) is <code> "normal"</code> .
571574
572575A subsequent {{Fragment}} is produced by using the previous {{Fragment}} 's {{Fragment/breakToken}} .
573576This tells the <a>child layout</a> to produce a {{Fragment}} starting at the point encoded in the
@@ -589,7 +592,7 @@ resume the layout.
589592
590593<pre class="lang-javascript">
591594registerLayout('indent-lines' , class {
592- static childDisplay = 'normal' ;
595+ static layoutOptions = {childDisplay: 'normal' } ;
593596 static inputProperties = ['--indent', '--indent-lines'] ;
594597
595598 *layout(constraints, children, styleMap, edges, breakToken) {
@@ -770,17 +773,36 @@ the size they would like the fragment to be.
770773If the user agent wishes to force a size on the box, it can use the
771774{{LayoutConstraints/fixedInlineSize}} and {{LayoutConstraints/fixedBlockSize}} attributes to do so.
772775
773- Issue: Do we want the inlineSize to always be fixed?
776+ The <a>layout API container</a> can be passed size information in different ways depending on the
777+ value of <a for="document layout definition">layout options</a> ' {{LayoutOptions/sizing}} (set by
778+ <code> layoutOptions</code> on the class).
774779
775- The downside to this is that we won't be able to things like MathML in the initial version of
776- the specifcation, which is able to "bubble" up inline sizes to its parent.
780+ If the value of <a for="document layout definition">layout options</a> ' {{LayoutOptions/sizing}} is
781+ <code> "block-like"</code> , then the {{LayoutConstraints}} passed to the <a>layout API container</a> :
782+ - <em> Must</em> calculate and set {{LayoutConstraints/fixedInlineSize}} based off the rules
783+ specified in [[!css-sizing-3]] and the formatting context in which it participates, e.g.
777784
778- We can't do a similar thing for the blockSize due to fragmentation. E.g. the size of the
779- fragment which is undergoing fragmentation, isn't able to be automatically resolved.
785+ - As a <a>block-level</a> box in a <a>block formatting context</a> , it is sized like a
786+ <a>block box</a> that establishes a formatting context, with an ''width/auto'' <a>inline
787+ size</a> calculated as for non-replaced block boxes.
780788
781- If the <a>layout API container</a> is within a <a>block formatting context</a> , is inflow, and has
782- an ''width/auto'' inline size, the user agent <em> must</em> set the
783- {{LayoutConstraints/fixedInlineSize}} to the <a>stretch-fit inline size</a> .
789+ - As an <a>inline-level</a> box in an <a>inline formatting context</a> , it is sized as an
790+ atomic inline-level box (such as an inline-block).
791+
792+ - <em> Must</em> calculate and set {{LayoutConstraints/fixedBlockSize}} based off the rules
793+ specified in [[!css-sizing-3]] , and the formatting context in which it participates. If the
794+ <a>layout API container</a> has an ''height/auto'' <a>block size</a> , and cannot be determined
795+ ahead of time, {{LayoutConstraints/fixedBlockSize}} must be set to <code> null</code> .
796+
797+ If the value of <a for="document layout definition">layout options</a> ' {{LayoutOptions/sizing}} is
798+ <code> "manual"</code> , then the user-agent shouldn't pre-calculate
799+ {{LayoutConstraints/fixedInlineSize}} and/or {{LayoutConstraints/fixedBlockSize}} ahead of time,
800+ except when it is being forced to a particular size by the formatting context in which it
801+ participates, for example:
802+
803+ - If the <a>layout API container</a> is within a <a>block formatting context</a> , is inflow, and
804+ has an ''width/auto'' inline size, the user agent <em> must</em> set the
805+ {{LayoutConstraints/fixedInlineSize}} to the <a>stretch-fit inline size</a> .
784806
785807<div class="note">
786808 Note: In the example below the <a>layout API container</a> has its inline size set to 50.
@@ -1012,7 +1034,7 @@ A <dfn>layout definition</dfn> is a <a>struct</a> which describes the informatio
10121034 - <dfn for="layout definition">child input properties</dfn> which is a <a>list</a> of
10131035 <code> DOMStrings</code> .
10141036
1015- - <dfn for="layout definition">child display </dfn> a {{ChildDisplayType }} .
1037+ - <dfn for="layout definition">layout options </dfn> a {{LayoutOptions }} .
10161038
10171039A <dfn>document layout definition</dfn> is a <a>struct</a> which describes the information needed by
10181040the <a>document</a> about the author defined layout (which can be referenced by the ''layout()''
@@ -1024,7 +1046,7 @@ function). It consists of:
10241046 - <dfn for="document layout definition">child input properties</dfn> which is a <a>list</a> of
10251047 <code> DOMStrings</code> .
10261048
1027- - <dfn for="document layout definition">child display </dfn> a {{ChildDisplayType }} .
1049+ - <dfn for="document layout definition">layout options </dfn> a {{LayoutOptions }} .
10281050
10291051Layout Worklet {#layout-worklet}
10301052--------------------------------
@@ -1053,11 +1075,23 @@ Registering A Layout {#registering-layout}
10531075------------------------------------------
10541076
10551077<pre class='idl'>
1078+ [Exposed=LayoutWorklet]
1079+ dictionary LayoutOptions {
1080+ ChildDisplayType childDisplay = "block";
1081+ LayoutSizingMode sizing = "block-like";
1082+ };
1083+
10561084[Exposed=LayoutWorklet]
10571085enum ChildDisplayType {
10581086 "block",
10591087 "normal",
10601088};
1089+
1090+ [Exposed=LayoutWorklet]
1091+ enum LayoutSizingMode {
1092+ "block-like",
1093+ "manual",
1094+ };
10611095</pre>
10621096
10631097Issue: "normal" is a bad name?
@@ -1109,40 +1143,38 @@ is called, the user agent <em>must</em> run the following steps:
11091143 <code> sequence<DOMString></code> . If an exception is <a>thrown</a> , rethrow the exception
11101144 and abort all these steps.
11111145
1112- 10. Let |childDisplay | be a {{ChildDisplayType}} set to <code> "block" </code> .
1146+ 10. Let |layoutOptionsValue | be the result of <a>Get</a> (|layoutCtor|, "layoutOptions") .
11131147
1114- 11. Let |childDisplayValue| be the result of <a>Get</a> (|layoutCtor|, "childDisplay").
1115-
1116- 12. If |childDisplayValue| if not undefined, then then |childDisplay| to the result of
1117- <a>converting</a> |childDisplayValue| to a {{ChildDisplayType}} . If an exception is
1118- <a>thrown</a> , rethrow the exception and abort all these steps.
1148+ 11. Let |layoutOptions| be the result of <a>converting</a> |layoutOptionsValue| to a
1149+ {{LayoutOptions}} . If an exception is <a>thrown</a> , rethrow the exception and abort all
1150+ these steps.
11191151
1120- 13 . If the result of <a>IsConstructor</a> (|layoutCtor|) is false, <a>throw</a> a
1152+ 12 . If the result of <a>IsConstructor</a> (|layoutCtor|) is false, <a>throw</a> a
11211153 <a>TypeError</a> and abort all these steps.
11221154
1123- 14 . Let |prototype| be the result of <a>Get</a> (|layoutCtor|, "prototype").
1155+ 13 . Let |prototype| be the result of <a>Get</a> (|layoutCtor|, "prototype").
11241156
1125- 15 . If the result of <a>Type</a> (|prototype|) is not Object, <a>throw</a> a <a>TypeError</a> and
1157+ 14 . If the result of <a>Type</a> (|prototype|) is not Object, <a>throw</a> a <a>TypeError</a> and
11261158 abort all these steps.
11271159
1128- 16 . Let |layout| be the result of <a>Get</a> (|prototype|, <code> "layout"</code> ).
1160+ 15 . Let |layout| be the result of <a>Get</a> (|prototype|, <code> "layout"</code> ).
11291161
1130- 17 . If the result of <a>IsCallable</a> (|layout|) is false, <a>throw</a> a <a>TypeError</a> and
1162+ 16 . If the result of <a>IsCallable</a> (|layout|) is false, <a>throw</a> a <a>TypeError</a> and
11311163 abort all these steps.
11321164
1133- 18 . If |layout|'s <code> \[[FunctionKind]] </code> internal slot is not <code> "generator"</code> ,
1165+ 17 . If |layout|'s <code> \[[FunctionKind]] </code> internal slot is not <code> "generator"</code> ,
11341166 <a>throw</a> a <a>TypeError</a> and abort all these steps.
11351167
1136- 19 . Let |intrinsicSizes| be the result of <a>Get</a> (|prototype|,
1168+ 18 . Let |intrinsicSizes| be the result of <a>Get</a> (|prototype|,
11371169 <code> "intrinsicSizes"</code> ).
11381170
1139- 20 . If the result of <a>IsCallable</a> (|intrinsicSizes|) is false, <a>throw</a> a
1171+ 19 . If the result of <a>IsCallable</a> (|intrinsicSizes|) is false, <a>throw</a> a
11401172 <a>TypeError</a> and abort all these steps.
11411173
1142- 21 . If |intrinsicSizes|'s <code> \[[FunctionKind]] </code> internal slot is not
1174+ 20 . If |intrinsicSizes|'s <code> \[[FunctionKind]] </code> internal slot is not
11431175 <code> "generator"</code> , <a>throw</a> a <a>TypeError</a> and abort all these steps.
11441176
1145- 22 . Let |definition| be a new <a>layout definition</a> with:
1177+ 21 . Let |definition| be a new <a>layout definition</a> with:
11461178
11471179 - <a>class constructor</a> being |layoutCtor|.
11481180
@@ -1156,11 +1188,11 @@ is called, the user agent <em>must</em> run the following steps:
11561188
11571189 - <a for="layout definition">child input properties</a> being |childInputProperties|.
11581190
1159- - <a for="layout definition">child display </a> being |childDisplay |.
1191+ - <a for="layout definition">layout options </a> being |layoutOptions |.
11601192
1161- 23 . <a for=map>Set</a> |layoutDefinitionMap|[|name|] to |definition|.
1193+ 22 . <a for=map>Set</a> |layoutDefinitionMap|[|name|] to |definition|.
11621194
1163- 24 . <a>Queue a task</a> to run the following steps:
1195+ 23 . <a>Queue a task</a> to run the following steps:
11641196
11651197 1. Let |documentLayoutDefinitionMap| be the associated <a>document's</a> <a>document layout
11661198 definitions</a> <a>map</a> .
@@ -1172,7 +1204,7 @@ is called, the user agent <em>must</em> run the following steps:
11721204 - <a for="document layout definition">child input properties</a> being
11731205 |childInputProperties|.
11741206
1175- - <a for="document layout definition">child display </a> being |childDisplay |.
1207+ - <a for="document layout definition">layout options </a> being |layoutOptions |.
11761208
11771209 3. If |documentLayoutDefinitionMap|[|name|] <a for=map>exists</a> , run the following steps:
11781210
@@ -1184,13 +1216,13 @@ is called, the user agent <em>must</em> run the following steps:
11841216 3. If |existingDocumentDefinition| and |documentDefinition| are not equivalent, (that is
11851217 <a for="document layout definition">input properties</a> , <a for="document layout
11861218 definition">child input properties</a> , and <a for="document layout
1187- definition">child display </a> are different), then:
1219+ definition">layout options </a> are different), then:
11881220
11891221 <a for=map>Set</a> |documentLayoutDefinitionMap|[|name|] to <code> "invalid"</code> .
11901222
11911223 Log an error to the debugging console stating that the same class was registered
11921224 with different <code> inputProperties</code> , <code> childInputProperties</code> , or
1193- <code> childDisplay </code> .
1225+ <code> layoutOptions </code> .
11941226
11951227 4. Otherwise, <a for=map>set</a> |documentLayoutDefinitionMap|[|name|] to
11961228 |documentDefinition|.
@@ -1201,7 +1233,9 @@ is called, the user agent <em>must</em> run the following steps:
12011233 class MyLayout {
12021234 static get inputProperties() { return ['--foo'] ; }
12031235 static get childrenInputProperties() { return ['--bar'] ; }
1204- static get childDisplay() { return 'normal' ; }
1236+ static get layoutOptions() {
1237+ return {childDisplay: 'normal' , sizing: 'block-like' }
1238+ }
12051239
12061240 *intrinsicSizes(children, styleMap) {
12071241 // Intrinsic sizes code goes here.
0 commit comments