@@ -12,13 +12,31 @@ Editor: Tab Atkins, jackalmage@gmail.com
1212Editor : Shane Stephens, shanestephens@google.com
1313Editor : Robert O'Callahan, robert@ocallahan.org
1414Editor : Rossen Atanassov, rossen.atanassov@microsoft.com
15+ Ignored Terms : LayoutWorklet
16+ Ignored Terms : create a workletglobalscope
1517</pre>
1618
19+ <style>
20+ /* Put nice boxes around each algorithm. */
21+ [data-algorithm] :not(.heading) {
22+ padding: .5em;
23+ border: thin solid #ddd; border-radius: .5em;
24+ margin: .5em calc(-0.5em - 1px);
25+ }
26+ [data-algorithm] :not(.heading) > :first-child {
27+ margin-top: 0;
28+ }
29+ [data-algorithm] :not(.heading) > :last-child {
30+ margin-bottom: 0;
31+ }
32+ </style>
33+
1734<pre class="link-defaults">
1835spec:css-break-3; type:dfn; text:fragment
1936spec:css-display-3; type:dfn; text:box
2037spec:css-display-3; type:value; for:display; text:none
21- spec:dom; type:dfn; text:element
38+ spec:css-display-3; type:value; for:<display-inside> ; text:grid
39+ spec:dom; type:dfn; for:/; text:element
2240</pre>
2341
2442<pre class="anchors">
@@ -37,7 +55,9 @@ urlPrefix: https://tc39.github.io/ecma262/#sec-; type: dfn;
3755 text: IsCallable
3856 text: IsConstructor
3957 text: HasProperty
58+ url: ecmascript-data-types-and-values; text: type
4059 url: get-o-p; text: Get
60+ url: generatorfunction; text: generator function
4161 url: terms-and-definitions-function; text: function
4262 urlPrefix: native-error-types-used-in-this-standard-
4363 text: TypeError
@@ -46,6 +66,8 @@ urlPrefix: https://tc39.github.io/ecma262/#sec-; type: dfn;
4666Introduction {#intro}
4767=====================
4868
69+ <em> This section is not normative.</em>
70+
4971The layout stage of CSS is responsible for generating and positioning <a>fragments</a> from the
5072<a>box tree</a> .
5173
@@ -156,8 +178,8 @@ An author cannot construct a {{LayoutChild}} with this API, this happens at a se
156178rendering engine (post style resolution).
157179
158180A {{InlineLayoutChild}} represents a sequence of non-<a>atomic inlines</a> . It does not have a
159- single <a> computed style</a> associated with it as it may contain multiple inline boxes inside it
160- with different <a> computed style</a> .
181+ single computed style associated with it as it may contain multiple inline boxes inside it
182+ with different computed style.
161183
162184<div class="note">
163185 Note: As an example the following would be placed into a single {{InlineLayoutChild}} :
@@ -178,12 +200,12 @@ rendering engines to perform text shaping across element boundaries.
178200 </pre>
179201</div>
180202
181- Note: In a future level of the specification there may be a way to query the <a> computed style</a>
203+ Note: In a future level of the specification there may be a way to query the computed style
182204 of ranges inside a {{InlineLayoutChild}} .
183205
184206A {{BoxLayoutChild}} represents a single <a>box</a> . It does have an associated computed style which
185207can be accessed by {{BoxLayoutChild/styleMap}} . The {{BoxLayoutChild/styleMap}} will only contain
186- properties which are listed in the <a> child input properties</a> array.
208+ properties which are listed in the child input properties array.
187209
188210A {{BoxLayoutChild}} could be generated by:
189211
@@ -197,7 +219,7 @@ A {{BoxLayoutChild}} could be generated by:
197219
198220 - An <a>anonymous box</a> . For example an anonymous box may be inserted as a result of:
199221
200- - A <a>Text</a> node which has undergone <a>blockification</a> . (Or more generally a
222+ - A text node which has undergone <a>blockification</a> . (Or more generally a
201223 {{InlineLayoutChild}} which has undergone <a>blockification</a> ).
202224
203225 - An element with ''display: table-cell'' which doesn't have a parent with ''display: table'' .
@@ -216,8 +238,8 @@ A {{BoxLayoutChild}} could be generated by:
216238 </pre>
217239</div>
218240
219- An array of {{LayoutChild}} ren is passed into the <a> layout method</a> which represents the children
220- of the current box which is being laid out.
241+ An array of {{LayoutChild}} ren is passed into the layout method which represents the children of the
242+ current box which is being laid out.
221243
222244To perform layout on a box the author can invoke the {{LayoutChild/layoutNextFragment()}} method.
223245This will produce a {{Fragment}} which contains layout information.
@@ -354,8 +376,6 @@ interface ConstraintSpace {
354376 readonly attribute boolean inlineSizeFixed;
355377 readonly attribute boolean blockSizeFixed;
356378
357- readonly attribute boolean inlineShrinkToFit;
358-
359379 readonly attribute double percentageInlineSize;
360380 readonly attribute double percentageBlockSize;
361381
@@ -372,8 +392,6 @@ dictionary ConstraintSpaceOptions {
372392 boolean inlineSizeFixed = false;
373393 boolean blockSizeFixed = false;
374394
375- boolean inlineShrinkToFit = false;
376-
377395 double? percentageInlineSize = null;
378396 double? percentageBlockSize = null;
379397
@@ -383,9 +401,9 @@ dictionary ConstraintSpaceOptions {
383401enum BlockFragmentationType { "none", "page", "column", "region" };
384402</pre>
385403
386- A {{ConstraintSpace}} is passed into the <a> layout method</a> which represents the available space
387- for the <a>current layout</a> to perform layout inside. It is also used to pass information about
388- the available space into a <a>child layout</a> .
404+ A {{ConstraintSpace}} is passed into the layout method which represents the available space for the
405+ <a>current layout</a> to perform layout inside. It is also used to pass information about the
406+ available space into a <a>child layout</a> .
389407
390408The {{ConstraintSpace}} has {{ConstraintSpace/inlineSize}} and {{ConstraintSpace/blockSize}}
391409attributes. This represents the <a>available space</a> for a {{Fragment}} which the layout should
@@ -422,7 +440,6 @@ registerLayout('flex-distribution-like', class {
422440
423441 const unconstrainedSizes = [];
424442 const childConstraintSpace = new ConstraintSpace({
425- inlineShrinkToFit: true,
426443 inlineSize: availableInlineSize,
427444 blockSize: availableBlockSize,
428445 });
@@ -471,9 +488,6 @@ registerLayout('flex-distribution-like', class {
471488</pre>
472489</div>
473490
474- The {{ConstraintSpace}} has a {{ConstraintSpace/inlineShrinkToFit}} attribute. This is used to
475- indicate that the layout should treat ''auto'' as ''fit-content'' instead.
476-
477491The {{ConstraintSpace}} has {{ConstraintSpace/percentageInlineSize}} and
478492{{ConstraintSpace/percentageBlockSize}} attributes. These represent the size that a layout
479493percentages should be resolved against while performing layout.
@@ -499,12 +513,12 @@ interface ChildBreakToken {
499513[Exposed=LayoutWorklet]
500514interface BreakToken {
501515 readonly attribute sequence<ChildBreakToken> childBreakTokens;
502- readonly attribute Object data;
516+ readonly attribute any data;
503517};
504518
505519dictionary BreakTokenOptions {
506520 sequence<ChildBreakToken> childBreakTokens;
507- Object data = null;
521+ any data = null;
508522};
509523
510524enum BreakType { "none", "inline", "inline-hyphen", "column", "page", "region" };
@@ -513,7 +527,7 @@ enum BreakType { "none", "inline", "inline-hyphen", "column", "page", "region" }
513527Issue: Fill out other inline type break types.
514528
515529A {{LayoutChild}} can produce multiple {{Fragment}} s. A {{BoxLayoutChild}} may fragment in the block
516- direction if a {{ConstraintSpace/blockFragmentation }} is not none. A {{InlineLayoutChild}} may
530+ direction if a {{ConstraintSpace/blockFragmentationType }} is not none. A {{InlineLayoutChild}} may
517531fragment in the inline direction.
518532
519533A subsequent {{Fragment}} is produced by using the previous {{Fragment}} 's {{Fragment/breakToken}} .
@@ -602,7 +616,6 @@ registerLayout('basic-inline', class extends Layout {
602616 inlineSize: availableInlineSize - usedInlineSize,
603617 blockSize: availableBlockSize,
604618 percentageInlineSize: availableInlineSize,
605- inlineShrinkToFit: true,
606619 });
607620
608621 const fragment = yield child.layoutNextFragment(constraintSpace,
@@ -741,18 +754,18 @@ Each <a>box</a> has an associated <dfn>layout valid flag</dfn>. It may be either
741754
742755Issue: The above flag is too restrictive on user agents, change.
743756
744- When the <a> computed style</a> for a |box| changes, the user agent must run the following steps:
757+ When the computed style for a |box| changes, the user agent must run the following steps:
745758 1. Let |layoutFunction| be the <<layout()>> or <<inline-layout()>> function of the 'display'
746- property on the <a> computed style</a> for the |box| if it exists. If it is a different type
747- of value (e.g. ''grid'' ) then abort all these steps.
759+ property on the computed style for the |box| if it exists. If it is a different type of
760+ value (e.g. ''grid'' ) then abort all these steps.
748761
749762 2. Let |name| be the first argument of the |layoutFunction|.
750763
751764 3. Let |inputProperties| be the result of looking up |name| on <a>layout name to input
752765 properties map</a> .
753766
754767 4. Let |childInputProperties| be the result of looking up |name| on <a>layout name to child
755- input properties map<a>.
768+ input properties map</ a> .
756769
757770 5. For each |property| in |inputProperties|, if the |property|'s <a>computed value</a> has
758771 changed, set the <a>layout valid flag</a> on the <a>box</a> to <a>layout-invalid</a> .
@@ -809,12 +822,12 @@ A <dfn>layout definition</dfn> describes an author defined layout which can be r
809822
810823 - A <dfn>layout class constructor valid flag</dfn> .
811824
812- The {{LayoutWorkletGlobalScope}} has a map of <b > layout name to layout definition map</b > . Initially
825+ The {{LayoutWorkletGlobalScope}} has a map of <dfn >layout name to layout definition map</dfn > . Initially
813826this map is empty; it is populated when {{registerLayout(name, layoutCtor)}} is called.
814827
815828When the <dfn method for=LayoutWorkletGlobalScope>registerLayout(|name|, |layoutCtor|)</dfn> method
816829is called, the user agent <em> must</em> run the following steps:
817- 1. If the |name| exists as a key in the <a>layout name to layout definition map</dfn >,
830+ 1. If the |name| exists as a key in the <a>layout name to layout definition map</a > ,
818831 <a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
819832
820833 2. If the |name| is an empty string, <a>throw</a> a <a>TypeError</a> and abort all these steps.
@@ -925,7 +938,7 @@ internal slots which encapsulates the {{LayoutChild/layoutNextFragment()}} metho
925938
926939When a {{FragmentRequest}} (s) are yielded from a layout generator object the user-agent's
927940layout engine may run the algorithm asynchronously with other work, and/or on a different thread of
928- execution. When {{Fragment}} (s) have been produced by the engine, the user-agent will ' tick' the
941+ execution. When {{Fragment}} (s) have been produced by the engine, the user-agent will " tick" the
929942generator object with the resulting {{Fragment}} (s).
930943
931944<div class="example">
@@ -998,7 +1011,7 @@ Issue: Specify how we do min/max content contributions.
9981011Issue: Need to specify that the {{LayoutChild}} objects should remain the same between layouts so
9991012 the author can store information? Not sure.
10001013
1001- When the user agent wants to <dfn>generate a layout API fragment</dfn> of a <a>layout API formatting
1014+ When the user agent wants to <dfn>generate a fragment</dfn> of a <a>layout API formatting
10021015context</a> for a given |box|, |constraintSpace|, |children| and an optional |breakToken| it
10031016<em> must</em> run the following steps:
10041017
@@ -1035,6 +1048,7 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
10351048 abort all these steps.
10361049
10371050 Issue: Define what an "invalid fragment" is.
1051+ <dfn>invalid fragment</dfn>
10381052
10391053 6. Let |layoutInstance| be the result of looking up the <a>layout instance</a> on the |box|. If
10401054 |layoutInstance| is null run the following substeps.
@@ -1052,8 +1066,8 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
10521066
10531067 4. Set <a>layout instance</a> on |box| to |layoutInstance|.
10541068
1055- Note: <a>Layout instance</a> will be set to null whenever the <a> computed style</a> of
1056- 'display' on |box| changes.
1069+ Note: <a>Layout instance</a> will be set to null whenever the computed style of 'display' on
1070+ |box| changes.
10571071
10581072 7. Let |layoutGeneratorFunction| be the result of looking up the <a>layout generator
10591073 function</a> .
@@ -1064,7 +1078,7 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
10641078 9. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em> only</em> the
10651079 <a>computed value</a> 's for properties listed in |inputProperties|.
10661080
1067- 10. Let |layoutGenerator| be the result of <a>Call </a> (|layoutGeneratorFunction|,
1081+ 10. Let |layoutGenerator| be the result of <a>Invoke </a> (|layoutGeneratorFunction|,
10681082 |layoutInstance|, «|constraintSpace|, |children|, |styleMap|, |breakToken|»).
10691083
10701084 12. Let |childFragmentResults| be «» (the empty list).
@@ -1105,28 +1119,28 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
11051119
11061120 14. Let |fragment| be a <a>fragment</a> with the following properties:
11071121
1108- - The <a>border box</a> <a>inline size</a> is set to |fragmentResult|'s
1109- {{FragmentResultOptions/inlineSize}} .
1122+ - The <a>inline size</a> is set to |fragmentResult|'s {{FragmentResultOptions/inlineSize}} .
11101123
1111- - The <a>border box</a> <a>block size</a> is set to |fragmentResult|'s
1112- {{FragmentResultOptions/blockSize}} .
1124+ - The <a>block size</a> is set to |fragmentResult|'s {{FragmentResultOptions/blockSize}} .
11131125
1114- - The <a >inline overflow size</a > is set to |fragmentResult|'s
1126+ - The <b > inline overflow size</b > is set to |fragmentResult|'s
11151127 {{FragmentResultOptions/inlineOverflowSize}} if not null, otherwise it is set to
11161128 {{FragmentResultOptions/inlineSize}} .
11171129
1118- - The <a>block overflow size</a> is set to |fragmentResult|'s
1130+ Issue: REMOVE THIS.
1131+
1132+ - The <b> block overflow size</b> is set to |fragmentResult|'s
11191133 {{FragmentResultOptions/blockOverflowSize}} if not null, otherwise it is set to
11201134 {{FragmentResultOptions/blockSize}} .
11211135
11221136 If the |constraintSpace|'s {{ConstraintSpace/inlineOverflow}} is <code> false</code> and
1123- the <a >inline overflow size</a > is greater than the <a>inline size</a> and the <a>computed
1124- value</a> for <a>inline</a> 'overflow' is ''auto'' then set |constraintSpace|'s
1137+ the <b > inline overflow size</b > is greater than the <a>inline size</a> and the <a>computed
1138+ value</a> for <a>inline</a> 'overflow' is ''overflow/ auto'' then set |constraintSpace|'s
11251139 {{ConstraintSpace/inlineOverflow}} to <code> true</code> .
11261140
11271141 If the |constraintSpace|'s {{ConstraintSpace/blockOverflow}} is <code> false</code> and the
1128- <a >block overflow size</a > is greater than the <a>block size</a> and the <a>computed
1129- value</a> for <a>block</a> 'overflow' is ''auto'' then set |constraintSpace|'s
1142+ <b > block overflow size</b > is greater than the <a>block size</a> and the <a>computed
1143+ value</a> for <a>block</a> 'overflow' is ''overflow/ auto'' then set |constraintSpace|'s
11301144 {{ConstraintSpace/blockOverflow}} to <code> true</code> .
11311145
11321146 If either {{ConstraintSpace/inlineOverflow}} or {{ConstraintSpace/blockOverflow}} were set
@@ -1135,13 +1149,15 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
11351149 Note: In a future level of the specification there may be a way to more efficiently abort
11361150 a layout given a "scroll trigger line" on the constraint space.
11371151
1152+ Issue: REMOVE THIS.
1153+
11381154 - The children fragments of the |fragment| is set from |fragmentResult|'s
11391155 {{FragmentResultOptions/childFragments}} . The ordering <em> is</em> important as this is
11401156 dictates their paint order (described in [[#layout-api-containers]] ). Their position
1141- relative to the <a >border box</a > of the |fragment| should be based off the author
1157+ relative to the <b > border box</b > of the |fragment| should be based off the author
11421158 specified {{Fragment/inlineOffset}} and {{Fragment/blockOffset}} .
11431159
1144- - The <a >fragmentation break</a > is set to |fragmentResult|'s
1160+ - The <b > fragmentation break</b > is set to |fragmentResult|'s
11451161 {{FragmentResultOptions/breakToken}} .
11461162
11471163 - The <a>alignment baseline</a> is set to |fragmentResult|'s
0 commit comments