Skip to content

Commit e9c80de

Browse files
committed
[css-layout-api] s/doLayout/layoutNextFragment/g
1 parent 8895a6e commit e9c80de

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

css-layout-api/EXPLAINER.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ registerLayout('centering', class extends Layout {
9797
let maxChildInlineSize = 0;
9898
let maxChildBlockSize = 0;
9999
for (let child of children) {
100-
const childFragment = yield child.doLayout(childConstraintSpace);
100+
const childFragment = yield child.layoutNextFragment(childConstraintSpace);
101101

102102
maxChildInlineSize = Math.max(maxChildInlineSize, childFragments.inlineSize);
103103
maxChildBlockSize = Math.max(maxChildBlockSize, childFragments.blockSize);
@@ -196,7 +196,7 @@ child constraint space just sets the size available to the children.
196196
We now loop through all of our children and perform layout. This is done by:
197197

198198
```js
199-
const childFragment = yield child.doLayout(childConstraintSpace);
199+
const childFragment = yield child.layoutNextFragment(childConstraintSpace);
200200
```
201201

202202
`child` has a very simple API. You can query the style of a child and perform layout - e.g.
@@ -205,7 +205,7 @@ const childFragment = yield child.doLayout(childConstraintSpace);
205205
child instanceof LayoutChild; // true
206206
child.styleMap.get('--a-property');
207207

208-
const fragment = yield child.doLayout(childConstraintSpace);
208+
const fragment = yield child.layoutNextFragment(childConstraintSpace);
209209
```
210210

211211
The result of performing layout on a child is a `Fragment`. A fragment is read-only except for
@@ -319,8 +319,8 @@ The quick brown fox jumped over the lazy dog.
319319
```js
320320
child instanceof LayoutChild;
321321

322-
const fragment1 = yield child.doLayout(constraintSpace);
323-
const fragment2 = yield child.doLayout(constraintSpace, fragment1.breakToken);
322+
const fragment1 = yield child.layoutNextFragment(constraintSpace);
323+
const fragment2 = yield child.layoutNextFragment(constraintSpace, fragment1.breakToken);
324324

325325
fragment2.breakToken == null;
326326
```
@@ -406,7 +406,7 @@ registerLayout('basic-inline', class extends Layout {
406406
inlineShrinkToFit: true,
407407
});
408408

409-
const fragment = yield child.doLayout(constraintSpace, childBreakToken);
409+
const fragment = yield child.layoutNextFragment(constraintSpace, childBreakToken);
410410
childFragments.push(fragment);
411411

412412
// Check if there is still space on the current line.
@@ -569,7 +569,7 @@ registerLayout('multi-col', class extends Layout {
569569
blockFragmentationType: 'column',
570570
});
571571

572-
const fragment = yield child.doLayout(childConstraintSpace);
572+
const fragment = yield child.layoutNextFragment(childConstraintSpace);
573573
}
574574

575575
// ...

css-layout-api/Overview.bs

+21-19
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Layout Children {#layout-children}
132132
<pre class='idl'>
133133
[Exposed=LayoutWorklet]
134134
interface LayoutChild {
135-
FragmentRequest doLayout(ConstraintSpace space, ChildBreakToken breakToken);
135+
FragmentRequest layoutNextFragment(ConstraintSpace space, ChildBreakToken breakToken);
136136
};
137137

138138
[Exposed=LayoutWorklet]
@@ -219,11 +219,11 @@ A {{BoxLayoutChild}} could be generated by:
219219
An array of {{LayoutChild}}ren is passed into the <a>layout method</a> which represents the children
220220
of the current box which is being laid out.
221221

222-
To perform layout on a box the author can invoke the {{LayoutChild/doLayout()}} method. This will
223-
produce a {{Fragment}} which contains layout information.
222+
To perform layout on a box the author can invoke the {{LayoutChild/layoutNextFragment()}} method.
223+
This will produce a {{Fragment}} which contains layout information.
224224

225-
The {{LayoutChild/doLayout()}} method may be invoked multiple times with different arguments to
226-
query the {{LayoutChild}} for different layout information.
225+
The {{LayoutChild/layoutNextFragment()}} method may be invoked multiple times with different
226+
arguments to query the {{LayoutChild}} for different layout information.
227227

228228
Layout Fragments {#layout-fragments}
229229
------------------------------------
@@ -247,12 +247,13 @@ interface Fragment {
247247
</pre>
248248

249249
A {{Fragment}} represents a CSS <a>fragment</a> of a {{LayoutChild}} after layout has occurred on
250-
that child. This is produced by the {{LayoutChild/doLayout()}} method.
250+
that child. This is produced by the {{LayoutChild/layoutNextFragment()}} method.
251251

252252
The {{Fragment}} has {{Fragment/inlineSize}} and {{Fragment/blockSize}} attributes, which are set by
253253
the respective child's layout algorithm. They cannot be changed. If the <a>current layout</a>
254254
requires a different {{Fragment/inlineSize}} or {{Fragment/blockSize}} the author must perform
255-
{{LayoutChild/doLayout()}} again with different arguments in order to get different results.
255+
{{LayoutChild/layoutNextFragment()}} again with different arguments in order to get different
256+
results.
256257

257258
The {{Fragment}} has {{Fragment/inlineOverflowSize}} and {{Fragment/blockOverflowSize}} attributes.
258259
This is the size of the overflow area of the fragment. If the fragment didn't overflow these
@@ -296,7 +297,7 @@ registerLayout('block-like', class extends Layout {
296297
let blockOffset = bordersAndPadding.blockStart;
297298

298299
for (let child of children) {
299-
const fragment = yield child.doLayout(childConstraintSpace);
300+
const fragment = yield child.layoutNextFragment(childConstraintSpace);
300301

301302
// Position the fragment in a block like manner, centering it in the
302303
// inline direction.
@@ -329,10 +330,11 @@ registerLayout('block-like', class extends Layout {
329330

330331
The {{Fragment}}'s {{Fragment/breakToken}} specifies where the {{LayoutChild}} last fragmented. If
331332
the {{Fragment/breakToken}} is null the {{LayoutChild}} wont produce any more {{Fragment}}s for that
332-
token chain. The {{Fragment/breakToken}} can be passed to the {{LayoutChild/doLayout()}} function to
333-
produce the next {{Fragment}} for a particular child. The {{Fragment/breakToken}} cannot be changed.
333+
token chain. The {{Fragment/breakToken}} can be passed to the {{LayoutChild/layoutNextFragment()}}
334+
function to produce the next {{Fragment}} for a particular child. The {{Fragment/breakToken}} cannot
335+
be changed.
334336
If the <a>current layout</a> requires a different {{Fragment/breakToken}} the author must perform
335-
{{LayoutChild/doLayout()}} again with different arguments.
337+
{{LayoutChild/layoutNextFragment()}} again with different arguments.
336338

337339
The {{Fragment}}'s {{Fragment/dominantBaseline}} attribute specify where the dominant baseline is
338340
positioned relative to the block start of the fragment. It cannot be changed.
@@ -428,7 +430,7 @@ registerLayout('flex-distribution-like', class {
428430

429431
// Calculate the unconstrained size for each child.
430432
for (let child of children) {
431-
const fragment = yield child.doLayout(childConstraintSpace);
433+
const fragment = yield child.layoutNextFragment(childConstraintSpace);
432434
unconstrainedSizes.push(fragment.inlineSize);
433435
totalSize += fragment.inlineSize;
434436
}
@@ -440,7 +442,7 @@ registerLayout('flex-distribution-like', class {
440442
let inlineOffset = 0;
441443
let maxChildBlockSize = 0;
442444
for (let i = 0; i < children.length; i++) {
443-
let fragment = yield child.doLayout(new ConstraintSpace({
445+
let fragment = yield child.layoutNextFragment(new ConstraintSpace({
444446
inlineSize: unconstrainedSizes[i] + extraSpace,
445447
inlineSizeFixed: true,
446448
blockSize: availableBlockSize
@@ -603,8 +605,8 @@ registerLayout('basic-inline', class extends Layout {
603605
inlineShrinkToFit: true,
604606
});
605607

606-
const fragment = yield child.doLayout(constraintSpace,
607-
childBreakToken);
608+
const fragment = yield child.layoutNextFragment(constraintSpace,
609+
childBreakToken);
608610
childFragments.push(fragment);
609611

610612
// Check if there is still space on the current line.
@@ -916,10 +918,10 @@ The layout method on the author supplied layout class is a generator function in
916918
javascript function. This is for user-agents to be able to support asynchronous and parallel layout
917919
engines.
918920

919-
When an author invokes the {{LayoutChild/doLayout()}} method on a {{LayoutChild}} the user-agent
920-
doesn't synchronously generate a {{Fragment}} to return to the author's code. Instead it returns a
921-
{{FragmentRequest}}. This is a completely opaque object to the author but contains internal
922-
slots which encapsulates the {{LayoutChild/doLayout()}} method call.
921+
When an author invokes the {{LayoutChild/layoutNextFragment()}} method on a {{LayoutChild}} the
922+
user-agent doesn't synchronously generate a {{Fragment}} to return to the author's code. Instead it
923+
returns a {{FragmentRequest}}. This is a completely opaque object to the author but contains
924+
internal slots which encapsulates the {{LayoutChild/layoutNextFragment()}} method call.
923925

924926
When a {{FragmentRequest}}(s) are yielded from a layout generator object the user-agent's
925927
layout engine may run the algorithm asynchronously with other work, and/or on a different thread of

0 commit comments

Comments
 (0)