Skip to content

Commit 6551dbc

Browse files
committed
[css-layout-api] Add generating request to LayoutFragment, IntrinsicSizes internal slot
1 parent 6a15159 commit 6551dbc

File tree

1 file changed

+64
-22
lines changed

1 file changed

+64
-22
lines changed

css-layout-api/Overview.bs

+64-22
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ interface LayoutFragment {
405405
};
406406
</pre>
407407

408+
The {{LayoutFragment}} has internal slot(s):
409+
- <dfn attribute for=LayoutFragment>\[[layoutFragmentRequest]]</dfn> a
410+
{{LayoutFragmentRequest}}, this is the fragment request which generated this fragment.
411+
412+
<hr>
413+
408414
A {{LayoutFragment}} represents a CSS <a>fragment</a> of a {{LayoutChild}} after layout has occurred
409415
on that child. This is produced by the {{LayoutChild/layoutNextFragment()}} method.
410416

@@ -493,6 +499,34 @@ particular child. The {{LayoutFragment/breakToken}} cannot be changed.
493499
If the <a>current layout</a> requires a different {{LayoutFragment/breakToken}} the author must perform
494500
{{LayoutChild/layoutNextFragment()}} again with different arguments.
495501

502+
<div algorithm>
503+
When the user agent wants to <dfn>create a layout fragment</dfn> given |targetRealm|,
504+
|layoutFragmentRequest|, and |internalFragment|, it <em>must</em> run the following steps:
505+
506+
1. Let |fragment| be a new {{LayoutFragment}} with:
507+
508+
- The {{[[layoutFragmentRequest]]}} internal slot being |layoutFragmentRequest|.
509+
510+
- {{LayoutFragment/inlineSize}} being |internalFragment|'s <a>inline size</a> relative to
511+
the <a>current layout's</a> writing mode.
512+
513+
- {{LayoutFragment/blockSize}} being |internalFragment|'s <a>block size</a> relative to the
514+
<a>current layout's</a> writing mode.
515+
516+
- {{LayoutFragment/inlineOffset}} initially set to 0.
517+
518+
- {{LayoutFragment/blockOffset}} initially set to 0.
519+
520+
- {{LayoutFragment/breakToken}} being a new {{ChildBreakToken}} representing
521+
|internalFragment|'s internal break token, if any.
522+
523+
- If |internalFragment| has a |clonedData| object stored with it, let
524+
{{LayoutFragment/data}} being the result of
525+
<a>StructuredDeserialize</a>(|clonedData|, |targetRealm|), otherwise null.
526+
527+
2. Return |fragment|.
528+
</div>
529+
496530
Intrinsic Sizes {#intrinsic-sizes}
497531
----------------------------------
498532

@@ -504,6 +538,13 @@ interface IntrinsicSizes {
504538
};
505539
</pre>
506540

541+
The {{IntrinsicSizes}} object has internal slot(s):
542+
- <dfn attribute for=IntrinsicSizes>\[[intrinsicSizesRequest]]</dfn> a
543+
{{IntrinsicSizesRequest}}, this is the intrinsic sizes request which generated these
544+
intrinsic sizes.
545+
546+
<hr>
547+
507548
A {{IntrinsicSizes}} object represents the <a>min-content size</a> and <a>max-content size</a> of a
508549
CSS <a>box</a>. It has {{IntrinsicSizes/minContentSize}} and {{IntrinsicSizes/maxContentSize}}
509550
attributes which represent the <b>border box</b> min/max-content contribution of the {{LayoutChild}}
@@ -558,6 +599,23 @@ registerLayout('intrinsic-sizes-example', class {
558599
</pre>
559600
</div>
560601

602+
<div algorithm>
603+
When the user agent wants to <dfn>create an intrinsic sizes object</dfn> given
604+
|intrinsicSizesRequest|, and |internalIntrinsicSizes|, it <em>must</em> run the following steps:
605+
606+
1. Let |intrinsicSizes| be a new {{IntrinsicSizes}} with:
607+
608+
- The {{[[intrinsicSizesRequest]]}} internal slot being |intrinsicSizesRequest|.
609+
610+
- {{IntrinsicSizes/minContentSize}} being |internalIntrinsicSizes|' <b>border box</b>
611+
min-content contribution, relative to the <a>current layout's</a> writing mode.
612+
613+
- {{IntrinsicSizes/maxContentSize}} being |internalIntrinsicSizes|'s <b>border box</b>
614+
max-content contribution, relative to the <a>current layout's</a> writing mode.
615+
616+
2. Return |intrinsicSizes|.
617+
</div>
618+
561619
Layout Constraints {#layout-constraints}
562620
----------------------------------------
563621

@@ -1921,13 +1979,11 @@ When the user agent wants to <dfn>run a generator</dfn> given |generator|, and |
19211979
1. Let |layoutChild| be the result of looking up the internal slot
19221980
<code>\[[layoutChild]]</code> on |request|.
19231981

1924-
2. Let |result| be a new {{IntrinsicSizes}} with:
1925-
1926-
- {{IntrinsicSizes/minContentSize}} being |layoutChild|'s <a>min-content
1927-
size</a>.
1982+
2. Let |internalIntrinsicSizes| be the result of the user agent calculating the
1983+
<b>border box</b> min/max content contribution of |layoutChild|.
19281984

1929-
- {{IntrinsicSizes/maxContentSize}} being |layoutChild|'s <a>max-content
1930-
size</a>.
1985+
3. Let |result| be the result of <a>create an intrinsic sizes object</a> given
1986+
|request|, and |internalIntrinsicSizes|.
19311987

19321988
3. If |request| is a {{LayoutFragmentRequest}} and |generatorType| is
19331989
<code>"layout"</code> then:
@@ -1947,22 +2003,8 @@ When the user agent wants to <dfn>run a generator</dfn> given |generator|, and |
19472003

19482004
5. Let |targetRealm| be |generator|'s <a>Realm</a>.
19492005

1950-
6. Let |result| be a new {{LayoutFragment}} with:
1951-
1952-
- {{LayoutFragment/inlineSize}} being |internalFragment|'s <a>inline size</a>.
1953-
1954-
- {{LayoutFragment/blockSize}} being |internalFragment|'s <a>block size</a>.
1955-
1956-
- {{LayoutFragment/inlineOffset}} initially set to 0.
1957-
1958-
- {{LayoutFragment/blockOffset}} initially set to 0.
1959-
1960-
- {{LayoutFragment/breakToken}} being a new {{ChildBreakToken}} representing
1961-
|layoutChild|'s internal break token.
1962-
1963-
- If |internalFragment| has a |clonedData| object stored with it, let
1964-
{{LayoutFragment/data}} being the result of
1965-
<a>StructuredDeserialize</a>(|clonedData|, |targetRealm|), otherwise null.
2006+
6. Let |result| be the result of <a>create a layout fragment</a> given
2007+
|targetRealm|, |request|, and |internalFragment|.
19662008

19672009
4. If |result| is null (that is neither of the above branches was taken), return
19682010
failure, and abort all these steps.

0 commit comments

Comments
 (0)