Skip to content

Commit 9d98895

Browse files
committed
[css-layout-api] Firm up alignment section, punting to a future level.
1 parent 2b7a980 commit 9d98895

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

css-layout-api/Overview.bs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -937,22 +937,40 @@ child to fragment.
937937
Alignment {#interaction-alignment}
938938
----------------------------------
939939

940-
<div class="issue">
941-
Issue: We need to add the ability to request baselines on the input layout constraints, and have a
942-
fragment returned what was asked. E.g.
940+
The first/last baseline sets of a <a>layout API contrainer</a> is generated exactly like block
941+
containers do (see [[css-align-3#baseline-export]]). Except that the order of the in-flow children
942+
should be determined by the in which they are returned form the layout method (via
943+
{{FragmentResultOptions/childFragments}}) instead of the document order.
943944

944-
<pre class="lang-javascript">
945-
const constraints = {
946-
inlineSize: availableInlineSize,
947-
baselines: ['alphabetic', 'middle'],
948-
};
949945

950-
const fragment = yield child.layoutNextFragment(constraints);
951-
fragment.baselines.get('alphabetic') == /* something */;
946+
<div class="note">
947+
Note: In a future level of the specification there will be the ability for the author to define the
948+
baselines themselves. This will be of the form:
949+
950+
To <em>query</em> baseline information from a {{LayoutChild}}.
951+
<pre class="lang-javascript">
952+
const fragment = yield child.layoutNextFragment({
953+
fixedInlineSize: availableInlineSize,
954+
baselineRequests: ['alphabetic', 'middle'],
955+
});
956+
fragment.baselines.get('alphabetic') === 25 /* or something */;
952957
</pre>
953958

954-
Do we want this in level 1? E.g. is it better to wait for implementations of [[css-align-3]] before
955-
doing this?
959+
To <em>produce</em> baseline information for a <a>parent layout</a>:
960+
<pre class="lang-javascript">
961+
registerLayout('baseline-producing', class {
962+
*layout(children, edges, constraints, styleMap) {
963+
const result = {baselines: {}};
964+
965+
for (let baselineRequest of constraints.baselineRequests) {
966+
// baselineRequest === 'alphabetic', or something else.
967+
result.baselines[baselineRequest] = 25;
968+
}
969+
970+
return result;
971+
}
972+
});
973+
</pre>
956974
</div>
957975

958976
Layout {#layout}

0 commit comments

Comments
 (0)