Skip to content

Commit 189c8fc

Browse files
committed
[css-layout-api] Firm up how a LayoutConstraints object is created wrt. different sizing modes.
1 parent d5fff69 commit 189c8fc

File tree

1 file changed

+56
-7
lines changed

1 file changed

+56
-7
lines changed

css-layout-api/Overview.bs

+56-7
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,52 @@ The <a>current layout</a> can choose not to fragment a {{LayoutChild}} based on
763763
{{LayoutConstraints/blockFragmentationType}}, for example if the child has a property like
764764
''break-inside: avoid-page;''.
765765

766+
<div algorithm>
767+
When the user agent wants to <dfn>create a layout constraints object</dfn> given |sizingMode|, box|,
768+
and |internalLayoutConstraints|, it <em>must</em> run the following steps:
769+
770+
1. If |sizingMode| is <code>"block-like"</code> then:
771+
772+
1. Let |fixedInlineSize| be the result of calculating |box|'s <b>border-box</b>
773+
<a>inline size</a> (relative to |box|'s writing mode) exactly like block containers do.
774+
775+
2. Let |fixedBlockSize| be null if |box|'s <a>block size</a> is ''height/auto'', otherwise
776+
the result of calculating |box|'s <b>border-box</b> <a>block size</a> exactly like block
777+
containers do.
778+
779+
3. Return a new {{LayoutConstraints}} object with:
780+
781+
- {{LayoutConstraints/fixedInlineSize}}, and {{LayoutConstraints/availableInlineSize}}
782+
set to |fixedInlineSize|.
783+
784+
- {{LayoutConstraints/percentageInlineSize}} set to |internalLayoutConstraints|'
785+
percentage resolution size in the inline axis (relative to |box|'s writing mode).
786+
787+
- {{LayoutConstraints/fixedBlockSize}} set to |fixedBlockSize|.
788+
789+
- {{LayoutConstraints/availableBlockSize}} set to |fixedBlockSize| if not null,
790+
otherwise |internalLayoutConstraints|' <a>available space</a> in the block axis
791+
(relative to |box|'s writing mode).
792+
793+
- {{LayoutConstraints/percentageBlockSize}} set to |internalLayoutConstraints|'
794+
percentage resolution size in the block axis (relative to |box|'s writing mode).
795+
796+
2. If |sizingMode| is <code>"manual"</code> then:
797+
798+
1. Return a new {{LayoutConstraints}} object with:
799+
- {{LayoutConstraints/fixedInlineSize}}/{{LayoutConstraints/fixedBlockSize}} set to
800+
|internalLayoutConstraints|' fixed inline/block size (relative to |box|'s writing
801+
mode) imposed by the <a>parent layout</a>. Either may be null.
802+
803+
Note: See [[#interaction-sizing]] for different scenarios when this can occur.
804+
805+
- {{LayoutConstraints/availableInlineSize}}/{{LayoutConstraints/availableBlockSize}} set
806+
to |internalLayoutConstraints|' <a>available space</a>.
807+
808+
- {{LayoutConstraints/percentageInlineSize}}/{{LayoutConstraints/percentageBlockSize}}
809+
set to |internalLayoutConstraints|' percentage resolution size.
810+
</div>
811+
766812
Breaking and Fragmentation {#breaking-and-fragmentation}
767813
--------------------------------------------------------
768814

@@ -1016,7 +1062,7 @@ If the value of <a for="document layout definition">layout options'</a> {{Layout
10161062
ahead of time, {{LayoutConstraints/fixedBlockSize}} must be set to <code>null</code>.
10171063

10181064
If the value of <a for="document layout definition">layout options'</a> {{LayoutOptions/sizing}} is
1019-
<code>"manual"</code>, then the user-agent shouldn't pre-calculate
1065+
<code>"manual"</code>, then the user-agent must not pre-calculate
10201066
{{LayoutConstraints/fixedInlineSize}} and/or {{LayoutConstraints/fixedBlockSize}} ahead of time,
10211067
except when it is being forced to a particular size by the formatting context in which it
10221068
participates, for example:
@@ -1829,22 +1875,25 @@ following steps:
18291875
If <a>get a layout class instance</a> returned failure, let the |box| fallback to the
18301876
<a>flow layout</a> and abort all these steps.
18311877

1832-
3. Let |inputProperties| be |definition|'s <a for="layout definition">input properties</a>.
1878+
3. Let |sizingMode| be |definition|'s <a for="layout definition">layout options</a>'
1879+
{{LayoutOptions/sizing}} property.
18331880

1834-
4. Let |children| be a new <a>list</a>.
1881+
4. Let |inputProperties| be |definition|'s <a for="layout definition">input properties</a>.
18351882

1836-
5. <a for=list>For each</a> |childBox| in |childBoxes| perform the following substeps:
1883+
5. Let |children| be a new <a>list</a>.
1884+
1885+
6. <a for=list>For each</a> |childBox| in |childBoxes| perform the following substeps:
18371886

18381887
1. Let |layoutChild| be the result of <a>get a layout child</a> given |workletGlobalScope|,
18391888
|name|, and |childBox|.
18401889

18411890
2. <a for=list>Append</a> |layoutChild| to |children|.
18421891

1843-
6. Let |edges| be a new {{LayoutEdgeSizes}} populated with the <a>computed value</a> for all the
1892+
7. Let |edges| be a new {{LayoutEdgeSizes}} populated with the <a>computed value</a> for all the
18441893
<a>box model edges</a> for |box|.
18451894

1846-
7. Let |layoutConstraints| be a new {{LayoutConstraints}} object populated with the appropriate
1847-
information from |internalLayoutConstraints|.
1895+
8. Let |layoutConstraints| be the result of <a>create a layout constraints object</a> given
1896+
|internalLayoutConstraints|, |box|, and |sizingMode|.
18481897

18491898
8. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em>only</em> the
18501899
<a>computed values</a> for properties listed in |inputProperties| for |box|.

0 commit comments

Comments
 (0)