@@ -1559,35 +1559,43 @@ the user agent must perform the following steps:
15591559 1. Return |this|' {{FragmentResult/[[block size]]}} internal slot.
15601560</div>
15611561
1562- Note: The {{FragmentResult(options)}} constructor performs a series of validation checks (the web
1563- developer isn't using an object from a previous invocation, and determines the final size of the
1564- resulting fragment.
1565-
15661562<div algorithm>
1567- When the <dfn constructor for=FragmentResult>FragmentResult(options)</dfn> constructor is called,
1568- the user agent must perform the following stpes :
1563+ When the <dfn constructor for=FragmentResult>FragmentResult(| options| )</dfn> constructor is called,
1564+ the user agent must perform the following steps :
15691565
15701566 1. Let |context| be the [=current layout's=] [=layout API context=] .
15711567
1572- 2. Let |uniqueId| be |context|'s [=unique id=] .
1568+ 2. Return the result of [=construct a fragment result=] given |context|, and |options|.
1569+
1570+ </div>
1571+
1572+ Note: The [=construct a fragment result=] algorithm performs a series of validation checks (the
1573+ web developer isn't using an object from a previous invocation, and determines the final size of
1574+ the resulting fragment.
1575+
1576+ <div algorithm="construct a fragment result">
1577+ When the user agent wants to <dfn>construct a fragment result</dfn> given |context|, and |options|
1578+ the user agent must perform the following steps:
1579+
1580+ 1. Let |uniqueId| be |context|'s [=unique id=] .
15731581
1574- 3 . Let |box| be the [=current layout's=] [=box=] .
1582+ 2 . Let |box| be the [=current layout's=] [=box=] .
15751583
1576- 4 . Let |breakTokenOptions| be |options|'s {{FragmentResultOptions/breakToken}} .
1584+ 3 . Let |breakTokenOptions| be |options|'s {{FragmentResultOptions/breakToken}} .
15771585
1578- 5 . [=list/For each=] |childFragment| in |options|'s {{FragmentResultOptions/childFragments}} ,
1586+ 4 . [=list/For each=] |childFragment| in |options|'s {{FragmentResultOptions/childFragments}} ,
15791587 perform the following stubsteps:
15801588
15811589 1. If |childFragment|'s {{LayoutFragment/[[unique id]]}} internal slot is not equal to
15821590 |uniqueId|, then [=throw=] a [=TypeError=] , and abort all these steps.
15831591
1584- 6 . [=list/For each=] |childBreakToken| in |breakTokenOptions|'s
1592+ 5 . [=list/For each=] |childBreakToken| in |breakTokenOptions|'s
15851593 {{BreakTokenOptions/childBreakTokens}} , perform the following stubsteps:
15861594
15871595 1. If |childBreakToken|'s {{ChildBreakToken/[[unique id]]}} internal slot is not equal to
15881596 |uniqueId|, then [=throw=] a [=TypeError=] , and abort all these steps.
15891597
1590- 7 . If |sizingMode| is <code> "block-like"</code> :
1598+ 6 . If |sizingMode| is <code> "block-like"</code> :
15911599
15921600 - Then:
15931601
@@ -1605,16 +1613,16 @@ the user agent must perform the following stpes:
16051613
16061614 2. Let |blockSize| be |fragment|'s {{FragmentResultOptions/blockSize}} .
16071615
1608- 8 . Let |clonedData| be the result of invoking [=StructuredSerializeForStorage=] on |options|'s
1616+ 7 . Let |clonedData| be the result of invoking [=StructuredSerializeForStorage=] on |options|'s
16091617 {{FragmentResultOptions/data}} .
16101618
1611- 9 . Let |clonedBreakTokenData| be the result of invoking [=StructuredSerializeForStorage=] on
1619+ 8 . Let |clonedBreakTokenData| be the result of invoking [=StructuredSerializeForStorage=] on
16121620 |breakTokenOptions|'s {{BreakTokenOptions/data}} .
16131621
1614- 10 . Let |internalBreakToken| be the internal representation of the [=fragmentation break=]
1622+ 9 . Let |internalBreakToken| be the internal representation of the [=fragmentation break=]
16151623 containing |clonedBreakTokenData|, and |breakTokenOptions|.
16161624
1617- 11 . Return a new {{FragmentResult}} with:
1625+ 10 . Return a new {{FragmentResult}} with:
16181626
16191627 - {{FragmentResult/[[box]]}} being |box|.
16201628
@@ -1718,19 +1726,25 @@ When the user agent wants to <dfn>invoke an intrinsic sizes callback</dfn> given
17181726
17191727 10. Let |intrinsicSizesFunction| be |definition|'s [=intrinsic sizes function=] .
17201728
1721- 11. Let |promise | be the result of [=Invoke=] (|intrinsicSizesFunction|, |layoutInstance|, «|children |,
1722- |edges|, |styleMap|»).
1729+ 11. Let |value | be the result of [=Invoke=] (|intrinsicSizesFunction|, |layoutInstance|,
1730+ «|children|, |edges|, |styleMap|»).
17231731
17241732 If an exception is [=thrown=] the let |box| fallback to the [=flow layout=] and abort all
17251733 these steps.
17261734
1727- Issue: Handle non-promise case.
1735+ 12. If |value| is a promise:
1736+
1737+ - Then:
17281738
1729- 12 . Let |intrinsicSizesValue| be the result of [=run a work queue=] given |promise |, and
1730- |context|'s [=work queue=] .
1739+ 1 . Let |intrinsicSizesValue| be the result of [=run a work queue=] given |value |, and
1740+ |context|'s [=work queue=] .
17311741
1732- If [=run a work queue=] returns failure, let the |box| fallback to the [=flow layout=] and
1733- abort all these steps.
1742+ If [=run a work queue=] returns failure, let the |box| fallback to the [=flow
1743+ layout=] and abort all these steps.
1744+
1745+ - Otherwise:
1746+
1747+ 1. Let |intrinsicSizesValue| be |value|.
17341748
17351749 13. Let |intrinsicSizes| be the result of [=converting=] |intrinsicSizesValue| to a
17361750 {{IntrinsicSizesResultOptions}} . If an exception is [=thrown=] , let |box| fallback to the
@@ -1842,30 +1856,50 @@ following steps:
18421856
18431857 13. Let |layoutFunction| be |definition|'s [=layout function=] .
18441858
1845- 14. Let |promise | be the result of [=Invoke=] (|layoutFunction|, |layoutInstance|,
1846- «|children|, |edges|, |layoutConstraints|, |styleMap|, |breakToken|»).
1859+ 14. Let |value | be the result of [=Invoke=] (|layoutFunction|, |layoutInstance|, «|children |,
1860+ |edges|, |layoutConstraints|, |styleMap|, |breakToken|»).
18471861
18481862 If an exception is [=thrown=] the let |box| fallback to the [=flow layout=] and abort all
18491863 these steps.
18501864
1851- 15. Let |fragmentValue| be the result of [=run a work queue=] given | promise|.
1865+ 15. If |value| is a promise:
18521866
1853- If [=run a work queue=] returns failure, let the |box| fallback to the [=flow layout=] and
1854- abort all these steps.
1867+ - Then:
18551868
1856- 16. Let |fragmentResultOptions| be the result of [=converting=] |fragmentValue| to a
1857- {{FragmentResultOptions}} . If an exception is [=thrown=] , let |box| fallback to the [=flow
1858- layout=] and abort all these steps.
1869+ 1. Let |fragmentResultValue| be the result of [=run a work queue=] given |value|.
18591870
1860- 17. Let |fragmentResult| be the result of constructing {{FragmentResult(options)}} given
1861- |fragmentResultOptions| .
1871+ If [=run a work queue=] returns failure, let the |box| fallback to the [=flow
1872+ layout=] and abort all these steps .
18621873
1863- If an exception is [=thrown=] the let |box| fallback to the [=flow layout=] and abort all
1864- these steps.
1874+ - Otherwise:
1875+
1876+ 1. Let |fragmentResultValue| be |value|.
1877+
1878+ 16. If |fragmentResultValue| is a [=platform object=] :
1879+
1880+ - Then:
1881+
1882+ 1. Let |fragmentResult| be the result [=converting=] |fragmentResultValue| to a
1883+ {{FragmentResult}} .
1884+
1885+ If an exception is [=thrown=] , let |box| fallback to the [=flow layout=] and abort all
1886+ these steps.
1887+
1888+ - Otherwise:
1889+
1890+ 1. Let |fragmentResultOptions| be the result of [=converting=] |fragmentResultValue| to
1891+ a {{FragmentResultOptions}} .
1892+
1893+ If an exception is [=thrown=] , let |box| fallback to the [=flow layout=] and abort
1894+ all these steps.
1895+
1896+ 2. Let |fragmentResult| be the result of [=construct a fragment result=] given
1897+ |fragmentResultOptions|.
18651898
1866- Issue: The above two steps may not be needed as it already might be a {{FragmentResult}} .
1899+ If an exception is [=thrown=] , let |box| fallback to the [=flow layout=] and abort
1900+ all these steps.
18671901
1868- 18 . Return an internal representation of a [=fragment=] with:
1902+ 17 . Return an internal representation of a [=fragment=] with:
18691903
18701904 - The [=inline size=] set to |fragmentResult|'s {{FragmentResult/[[inline size]]}} .
18711905
0 commit comments