@@ -1559,35 +1559,43 @@ the user agent must perform the following steps:
1559
1559
1. Return |this|' {{FragmentResult/[[block size]]}} internal slot.
1560
1560
</div>
1561
1561
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
-
1566
1562
<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 :
1569
1565
1570
1566
1. Let |context| be the [=current layout's=] [=layout API context=] .
1571
1567
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=] .
1573
1581
1574
- 3 . Let |box| be the [=current layout's=] [=box=] .
1582
+ 2 . Let |box| be the [=current layout's=] [=box=] .
1575
1583
1576
- 4 . Let |breakTokenOptions| be |options|'s {{FragmentResultOptions/breakToken}} .
1584
+ 3 . Let |breakTokenOptions| be |options|'s {{FragmentResultOptions/breakToken}} .
1577
1585
1578
- 5 . [=list/For each=] |childFragment| in |options|'s {{FragmentResultOptions/childFragments}} ,
1586
+ 4 . [=list/For each=] |childFragment| in |options|'s {{FragmentResultOptions/childFragments}} ,
1579
1587
perform the following stubsteps:
1580
1588
1581
1589
1. If |childFragment|'s {{LayoutFragment/[[unique id]]}} internal slot is not equal to
1582
1590
|uniqueId|, then [=throw=] a [=TypeError=] , and abort all these steps.
1583
1591
1584
- 6 . [=list/For each=] |childBreakToken| in |breakTokenOptions|'s
1592
+ 5 . [=list/For each=] |childBreakToken| in |breakTokenOptions|'s
1585
1593
{{BreakTokenOptions/childBreakTokens}} , perform the following stubsteps:
1586
1594
1587
1595
1. If |childBreakToken|'s {{ChildBreakToken/[[unique id]]}} internal slot is not equal to
1588
1596
|uniqueId|, then [=throw=] a [=TypeError=] , and abort all these steps.
1589
1597
1590
- 7 . If |sizingMode| is <code> "block-like"</code> :
1598
+ 6 . If |sizingMode| is <code> "block-like"</code> :
1591
1599
1592
1600
- Then:
1593
1601
@@ -1605,16 +1613,16 @@ the user agent must perform the following stpes:
1605
1613
1606
1614
2. Let |blockSize| be |fragment|'s {{FragmentResultOptions/blockSize}} .
1607
1615
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
1609
1617
{{FragmentResultOptions/data}} .
1610
1618
1611
- 9 . Let |clonedBreakTokenData| be the result of invoking [=StructuredSerializeForStorage=] on
1619
+ 8 . Let |clonedBreakTokenData| be the result of invoking [=StructuredSerializeForStorage=] on
1612
1620
|breakTokenOptions|'s {{BreakTokenOptions/data}} .
1613
1621
1614
- 10 . Let |internalBreakToken| be the internal representation of the [=fragmentation break=]
1622
+ 9 . Let |internalBreakToken| be the internal representation of the [=fragmentation break=]
1615
1623
containing |clonedBreakTokenData|, and |breakTokenOptions|.
1616
1624
1617
- 11 . Return a new {{FragmentResult}} with:
1625
+ 10 . Return a new {{FragmentResult}} with:
1618
1626
1619
1627
- {{FragmentResult/[[box]]}} being |box|.
1620
1628
@@ -1718,19 +1726,25 @@ When the user agent wants to <dfn>invoke an intrinsic sizes callback</dfn> given
1718
1726
1719
1727
10. Let |intrinsicSizesFunction| be |definition|'s [=intrinsic sizes function=] .
1720
1728
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|»).
1723
1731
1724
1732
If an exception is [=thrown=] the let |box| fallback to the [=flow layout=] and abort all
1725
1733
these steps.
1726
1734
1727
- Issue: Handle non-promise case.
1735
+ 12. If |value| is a promise:
1736
+
1737
+ - Then:
1728
1738
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=] .
1731
1741
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|.
1734
1748
1735
1749
13. Let |intrinsicSizes| be the result of [=converting=] |intrinsicSizesValue| to a
1736
1750
{{IntrinsicSizesResultOptions}} . If an exception is [=thrown=] , let |box| fallback to the
@@ -1842,30 +1856,50 @@ following steps:
1842
1856
1843
1857
13. Let |layoutFunction| be |definition|'s [=layout function=] .
1844
1858
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|»).
1847
1861
1848
1862
If an exception is [=thrown=] the let |box| fallback to the [=flow layout=] and abort all
1849
1863
these steps.
1850
1864
1851
- 15. Let |fragmentValue| be the result of [=run a work queue=] given | promise|.
1865
+ 15. If |value| is a promise:
1852
1866
1853
- If [=run a work queue=] returns failure, let the |box| fallback to the [=flow layout=] and
1854
- abort all these steps.
1867
+ - Then:
1855
1868
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|.
1859
1870
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 .
1862
1873
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|.
1865
1898
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.
1867
1901
1868
- 18 . Return an internal representation of a [=fragment=] with:
1902
+ 17 . Return an internal representation of a [=fragment=] with:
1869
1903
1870
1904
- The [=inline size=] set to |fragmentResult|'s {{FragmentResult/[[inline size]]}} .
1871
1905
0 commit comments