Skip to content

Commit 0733950

Browse files
committed
[css-layout-api] Describe how to translate LayoutConstraintsOptions.
1 parent 199ca9f commit 0733950

File tree

1 file changed

+80
-3
lines changed

1 file changed

+80
-3
lines changed

css-layout-api/Overview.bs

+80-3
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,80 @@ dictionary LayoutConstraintsOptions {
10491049
};
10501050
</pre>
10511051

1052+
Note: The [=translate a LayoutConstraintsOptions to internal constraints=] describes how to convert
1053+
a {{LayoutConstraintsOptions}} object into a user agents internal representation.
1054+
1055+
<div algorithm="translate a LayoutConstraintsOptions to internal constraints">
1056+
When the user agent wants to <dfn>translate a LayoutConstraintsOptions to internal constraints</dfn>
1057+
given |options|, it <em>must</em> run the following steps:
1058+
1059+
1. Let the [=available space=] in the inline direction (with respect to the [=current layout=],
1060+
be the result of:
1061+
1062+
- If |options|' {{LayoutConstraintsOptions/availableInlineSize}} is not null, and
1063+
{{LayoutConstraintsOptions/availableInlineSize}} is greater than zero, let the result be
1064+
{{LayoutConstraintsOptions/availableInlineSize}}.
1065+
1066+
- Otherwhise, let the result be zero.
1067+
1068+
2. Let the [=available space=] in the block direction (with respect to the [=current layout=]),
1069+
be the result of:
1070+
1071+
- If |options|' {{LayoutConstraintsOptions/availableBlockSize}} is not null, and
1072+
{{LayoutConstraintsOptions/availableBlockSize}} is greater than zero, let the result be
1073+
{{LayoutConstraintsOptions/availableBlockSize}}.
1074+
1075+
- Otherwhise, let the result be zero.
1076+
1077+
3. Let the override size in the inline direction (with respect to the [=current layout=], be the
1078+
result of:
1079+
1080+
- Let the result be |options|' {{LayoutConstraintsOptions/fixedInlineSize}}.
1081+
1082+
Note: If the {{LayoutConstraintsOptions/fixedInlineSize}} is null, no override size is
1083+
applied.
1084+
1085+
4. Let the override size in the block direction (with respect to the [=current layout=], be the
1086+
result of:
1087+
1088+
- Let the result be |options|' {{LayoutConstraintsOptions/fixedBlockSize}}.
1089+
1090+
Note: If the {{LayoutConstraintsOptions/fixedBlockSize}} is null, no override size is
1091+
applied.
1092+
1093+
5. Let the percentage resultion size in the inline direction (with respect to the [=current
1094+
layout=], be the result of:
1095+
1096+
- If |options|' {{LayoutConstraintsOptions/percentageInlineSize}} is not null, and
1097+
{{LayoutConstraintsOptions/percentageInlineSize}} is greater than zero, let the result
1098+
be {{LayoutConstraintsOptions/percentageInlineSize}}.
1099+
1100+
- If |options|' {{LayoutConstraintsOptions/availableInlineSize}} is not null, and
1101+
{{LayoutConstraintsOptions/availableInlineSize}} is greater than zero, let the result be
1102+
{{LayoutConstraintsOptions/availableInlineSize}}.
1103+
1104+
- Otherwhise, let the result be zero.
1105+
1106+
6. Let the percentage resultion size in the block direction (with respect to the [=current
1107+
layout=], be the result of:
1108+
1109+
- If |options|' {{LayoutConstraintsOptions/percentageBlockSize}} is not null, and
1110+
{{LayoutConstraintsOptions/percentageBlockSize}} is greater than zero, let the result
1111+
be {{LayoutConstraintsOptions/percentageBlockSize}}.
1112+
1113+
- If |options|' {{LayoutConstraintsOptions/availableBlockSize}} is not null, and
1114+
{{LayoutConstraintsOptions/availableBlockSize}} is greater than zero, let the result be
1115+
{{LayoutConstraintsOptions/availableBlockSize}}.
1116+
1117+
- Otherwhise, let the result be zero.
1118+
1119+
7. If the [=child layout=] is a [=layout API container=], then let the store the data (passed by
1120+
{{LayoutConstraints/data}}) be the result of:
1121+
1122+
- Invoking [=StructuredSerializeForStorage=] on |options|'
1123+
{{LayoutConstraintsOptions/data}}.
1124+
</div>
1125+
10521126
<div class="example">
10531127
The example below shows the basic usage of the {{LayoutConstraintsOptions}} dictionary.
10541128

@@ -1077,8 +1151,6 @@ registerLayout('child-layout-constraints-example', class {
10771151
</pre>
10781152
</div>
10791153

1080-
Issue: Specify how to convert to internal representation of these values.
1081-
10821154
Breaking and Fragmentation {#breaking-and-fragmentation}
10831155
--------------------------------------------------------
10841156

@@ -2034,7 +2106,7 @@ When the user agent wants to <dfn>run a work queue</dfn> given |promise|, and |w
20342106

20352107
2. Let |box| be |layoutChild|'s [=box=] in the {{LayoutChild/[[box]]}} internal slot.
20362108

2037-
3. Let |childPromise| be |task|'s [=layout api work task/=promise].
2109+
3. Let |childPromise| be |task|'s [=layout api work task/promise=].
20382110

20392111
2. If |task|'s [=layout api work task/task type=] is <code>"layout"</code>,
20402112

@@ -2049,6 +2121,11 @@ When the user agent wants to <dfn>run a work queue</dfn> given |promise|, and |w
20492121
4. Let |internalFragment| be the result of the user agent producing a
20502122
[=fragment=] based on |box|, |childConstraints|, and |childBreakToken|.
20512123

2124+
Invoking [=translate a LayoutConstraintsOptions to internal constraints=]
2125+
given |childConstraints|, must be run to translate the given
2126+
{{LayoutConstraintsOptions}} into the internal constraints for the user
2127+
agent's layout engine.
2128+
20522129
5. Let |fragment| be a new {{LayoutFragment}} with:
20532130

20542131
- {{LayoutFragment/inlineSize}} being |internalFragment|'s [=inline size=]

0 commit comments

Comments
 (0)