@@ -12,13 +12,31 @@ Editor: Tab Atkins, jackalmage@gmail.com
12
12
Editor : Shane Stephens, shanestephens@google.com
13
13
Editor : Robert O'Callahan, robert@ocallahan.org
14
14
Editor : Rossen Atanassov, rossen.atanassov@microsoft.com
15
+ Ignored Terms : LayoutWorklet
16
+ Ignored Terms : create a workletglobalscope
15
17
</pre>
16
18
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
+
17
34
<pre class="link-defaults">
18
35
spec:css-break-3; type:dfn; text:fragment
19
36
spec:css-display-3; type:dfn; text:box
20
37
spec: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
22
40
</pre>
23
41
24
42
<pre class="anchors">
@@ -37,7 +55,9 @@ urlPrefix: https://tc39.github.io/ecma262/#sec-; type: dfn;
37
55
text: IsCallable
38
56
text: IsConstructor
39
57
text: HasProperty
58
+ url: ecmascript-data-types-and-values; text: type
40
59
url: get-o-p; text: Get
60
+ url: generatorfunction; text: generator function
41
61
url: terms-and-definitions-function; text: function
42
62
urlPrefix: native-error-types-used-in-this-standard-
43
63
text: TypeError
@@ -46,6 +66,8 @@ urlPrefix: https://tc39.github.io/ecma262/#sec-; type: dfn;
46
66
Introduction {#intro}
47
67
=====================
48
68
69
+ <em> This section is not normative.</em>
70
+
49
71
The layout stage of CSS is responsible for generating and positioning <a>fragments</a> from the
50
72
<a>box tree</a> .
51
73
@@ -156,8 +178,8 @@ An author cannot construct a {{LayoutChild}} with this API, this happens at a se
156
178
rendering engine (post style resolution).
157
179
158
180
A {{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.
161
183
162
184
<div class="note">
163
185
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.
178
200
</pre>
179
201
</div>
180
202
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
182
204
of ranges inside a {{InlineLayoutChild}} .
183
205
184
206
A {{BoxLayoutChild}} represents a single <a>box</a> . It does have an associated computed style which
185
207
can 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.
187
209
188
210
A {{BoxLayoutChild}} could be generated by:
189
211
@@ -197,7 +219,7 @@ A {{BoxLayoutChild}} could be generated by:
197
219
198
220
- An <a>anonymous box</a> . For example an anonymous box may be inserted as a result of:
199
221
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
201
223
{{InlineLayoutChild}} which has undergone <a>blockification</a> ).
202
224
203
225
- 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:
216
238
</pre>
217
239
</div>
218
240
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.
221
243
222
244
To perform layout on a box the author can invoke the {{LayoutChild/layoutNextFragment()}} method.
223
245
This will produce a {{Fragment}} which contains layout information.
@@ -354,8 +376,6 @@ interface ConstraintSpace {
354
376
readonly attribute boolean inlineSizeFixed;
355
377
readonly attribute boolean blockSizeFixed;
356
378
357
- readonly attribute boolean inlineShrinkToFit;
358
-
359
379
readonly attribute double percentageInlineSize;
360
380
readonly attribute double percentageBlockSize;
361
381
@@ -372,8 +392,6 @@ dictionary ConstraintSpaceOptions {
372
392
boolean inlineSizeFixed = false;
373
393
boolean blockSizeFixed = false;
374
394
375
- boolean inlineShrinkToFit = false;
376
-
377
395
double? percentageInlineSize = null;
378
396
double? percentageBlockSize = null;
379
397
@@ -383,9 +401,9 @@ dictionary ConstraintSpaceOptions {
383
401
enum BlockFragmentationType { "none", "page", "column", "region" };
384
402
</pre>
385
403
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> .
389
407
390
408
The {{ConstraintSpace}} has {{ConstraintSpace/inlineSize}} and {{ConstraintSpace/blockSize}}
391
409
attributes. This represents the <a>available space</a> for a {{Fragment}} which the layout should
@@ -422,7 +440,6 @@ registerLayout('flex-distribution-like', class {
422
440
423
441
const unconstrainedSizes = [];
424
442
const childConstraintSpace = new ConstraintSpace({
425
- inlineShrinkToFit: true,
426
443
inlineSize: availableInlineSize,
427
444
blockSize: availableBlockSize,
428
445
});
@@ -471,9 +488,6 @@ registerLayout('flex-distribution-like', class {
471
488
</pre>
472
489
</div>
473
490
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
-
477
491
The {{ConstraintSpace}} has {{ConstraintSpace/percentageInlineSize}} and
478
492
{{ConstraintSpace/percentageBlockSize}} attributes. These represent the size that a layout
479
493
percentages should be resolved against while performing layout.
@@ -499,12 +513,12 @@ interface ChildBreakToken {
499
513
[Exposed=LayoutWorklet]
500
514
interface BreakToken {
501
515
readonly attribute sequence<ChildBreakToken> childBreakTokens;
502
- readonly attribute Object data;
516
+ readonly attribute any data;
503
517
};
504
518
505
519
dictionary BreakTokenOptions {
506
520
sequence<ChildBreakToken> childBreakTokens;
507
- Object data = null;
521
+ any data = null;
508
522
};
509
523
510
524
enum BreakType { "none", "inline", "inline-hyphen", "column", "page", "region" };
@@ -513,7 +527,7 @@ enum BreakType { "none", "inline", "inline-hyphen", "column", "page", "region" }
513
527
Issue: Fill out other inline type break types.
514
528
515
529
A {{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
517
531
fragment in the inline direction.
518
532
519
533
A subsequent {{Fragment}} is produced by using the previous {{Fragment}} 's {{Fragment/breakToken}} .
@@ -602,7 +616,6 @@ registerLayout('basic-inline', class extends Layout {
602
616
inlineSize: availableInlineSize - usedInlineSize,
603
617
blockSize: availableBlockSize,
604
618
percentageInlineSize: availableInlineSize,
605
- inlineShrinkToFit: true,
606
619
});
607
620
608
621
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
741
754
742
755
Issue: The above flag is too restrictive on user agents, change.
743
756
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:
745
758
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.
748
761
749
762
2. Let |name| be the first argument of the |layoutFunction|.
750
763
751
764
3. Let |inputProperties| be the result of looking up |name| on <a>layout name to input
752
765
properties map</a> .
753
766
754
767
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> .
756
769
757
770
5. For each |property| in |inputProperties|, if the |property|'s <a>computed value</a> has
758
771
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
809
822
810
823
- A <dfn>layout class constructor valid flag</dfn> .
811
824
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
813
826
this map is empty; it is populated when {{registerLayout(name, layoutCtor)}} is called.
814
827
815
828
When the <dfn method for=LayoutWorkletGlobalScope>registerLayout(|name|, |layoutCtor|)</dfn> method
816
829
is 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 > ,
818
831
<a>throw</a> a <a>NotSupportedError</a> and abort all these steps.
819
832
820
833
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
925
938
926
939
When a {{FragmentRequest}} (s) are yielded from a layout generator object the user-agent's
927
940
layout 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
929
942
generator object with the resulting {{Fragment}} (s).
930
943
931
944
<div class="example">
@@ -998,7 +1011,7 @@ Issue: Specify how we do min/max content contributions.
998
1011
Issue: Need to specify that the {{LayoutChild}} objects should remain the same between layouts so
999
1012
the author can store information? Not sure.
1000
1013
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
1002
1015
context</a> for a given |box|, |constraintSpace|, |children| and an optional |breakToken| it
1003
1016
<em> must</em> run the following steps:
1004
1017
@@ -1035,6 +1048,7 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
1035
1048
abort all these steps.
1036
1049
1037
1050
Issue: Define what an "invalid fragment" is.
1051
+ <dfn>invalid fragment</dfn>
1038
1052
1039
1053
6. Let |layoutInstance| be the result of looking up the <a>layout instance</a> on the |box|. If
1040
1054
|layoutInstance| is null run the following substeps.
@@ -1052,8 +1066,8 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
1052
1066
1053
1067
4. Set <a>layout instance</a> on |box| to |layoutInstance|.
1054
1068
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.
1057
1071
1058
1072
7. Let |layoutGeneratorFunction| be the result of looking up the <a>layout generator
1059
1073
function</a> .
@@ -1064,7 +1078,7 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
1064
1078
9. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em> only</em> the
1065
1079
<a>computed value</a> 's for properties listed in |inputProperties|.
1066
1080
1067
- 10. Let |layoutGenerator| be the result of <a>Call </a> (|layoutGeneratorFunction|,
1081
+ 10. Let |layoutGenerator| be the result of <a>Invoke </a> (|layoutGeneratorFunction|,
1068
1082
|layoutInstance|, «|constraintSpace|, |children|, |styleMap|, |breakToken|»).
1069
1083
1070
1084
12. Let |childFragmentResults| be «» (the empty list).
@@ -1105,28 +1119,28 @@ context</a> for a given |box|, |constraintSpace|, |children| and an optional |br
1105
1119
1106
1120
14. Let |fragment| be a <a>fragment</a> with the following properties:
1107
1121
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}} .
1110
1123
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}} .
1113
1125
1114
- - The <a >inline overflow size</a > is set to |fragmentResult|'s
1126
+ - The <b > inline overflow size</b > is set to |fragmentResult|'s
1115
1127
{{FragmentResultOptions/inlineOverflowSize}} if not null, otherwise it is set to
1116
1128
{{FragmentResultOptions/inlineSize}} .
1117
1129
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
1119
1133
{{FragmentResultOptions/blockOverflowSize}} if not null, otherwise it is set to
1120
1134
{{FragmentResultOptions/blockSize}} .
1121
1135
1122
1136
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
1125
1139
{{ConstraintSpace/inlineOverflow}} to <code> true</code> .
1126
1140
1127
1141
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
1130
1144
{{ConstraintSpace/blockOverflow}} to <code> true</code> .
1131
1145
1132
1146
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
1135
1149
Note: In a future level of the specification there may be a way to more efficiently abort
1136
1150
a layout given a "scroll trigger line" on the constraint space.
1137
1151
1152
+ Issue: REMOVE THIS.
1153
+
1138
1154
- The children fragments of the |fragment| is set from |fragmentResult|'s
1139
1155
{{FragmentResultOptions/childFragments}} . The ordering <em> is</em> important as this is
1140
1156
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
1142
1158
specified {{Fragment/inlineOffset}} and {{Fragment/blockOffset}} .
1143
1159
1144
- - The <a >fragmentation break</a > is set to |fragmentResult|'s
1160
+ - The <b > fragmentation break</b > is set to |fragmentResult|'s
1145
1161
{{FragmentResultOptions/breakToken}} .
1146
1162
1147
1163
- The <a>alignment baseline</a> is set to |fragmentResult|'s
0 commit comments