@@ -1355,9 +1355,9 @@ is empty; it is populated when {{registerLayout(name, layoutCtor)}} is called.
1355
1355
The {{LayoutWorkletGlobalScope}} has a <a>map</a> of <dfn>layout definitions</dfn> . Initially this
1356
1356
map is empty; it is populated when {{registerLayout(name, layoutCtor)}} is called.
1357
1357
1358
- The {{LayoutWorkletGlobalScope}} has a <a>map</a> of <dfn>layout class instances</dfn> . Initially
1359
- this map is empty; it is populated when the user agent calls either <a>determine the intrinsic
1360
- sizes</a> or <a>generate a fragment</a> for a <a>box</a> .
1358
+ Each <a>box</a> representing a <a>layout API container</a> has a <a>map</a> of <dfn>layout class
1359
+ instances</dfn> . Initially this map is empty; it is populated when the user agent calls either
1360
+ <a>determine the intrinsic sizes</a> or <a>generate a fragment</a> for a <a>box</a> .
1361
1361
1362
1362
<div algorithm>
1363
1363
When the <dfn method for=LayoutWorkletGlobalScope>registerLayout(|name|, |layoutCtor|)</dfn> method
@@ -1692,30 +1692,31 @@ When the user agent wants to <dfn>invoke a intrinsic sizes callback</dfn> given
1692
1692
If <a>get a layout definition</a> returned failure, let the |box| fallback to the <a>flow
1693
1693
layout</a> and abort all these steps.
1694
1694
1695
- 2. Let |layoutInstance| be the result of <a>get a layout class instance</a> given |name|, | box|,
1695
+ 2. Let |layoutInstance| be the result of <a>get a layout class instance</a> given |box|,
1696
1696
|definition|, |workletGlobalScope|.
1697
1697
1698
1698
If <a>get a layout class instance</a> returned failure, let the |box| fallback to the
1699
1699
<a>flow layout</a> and abort all these steps.
1700
1700
1701
1701
3. Let |inputProperties| be |definition|'s <a for="layout definition">input properties</a> .
1702
1702
1703
- 4. Let |childInputProperties| be |definition|'s <a for="layout definition">child input
1704
- properties</a> .
1703
+ 4. Let |children| be a new <a>list</a> .
1704
+
1705
+ 5. <a for=list>For each</a> |childBox| in |childBoxes| perform the following substeps:
1705
1706
1706
- 5 . Let |children | be a new <a>list </a> populated with new {{LayoutChild}} objects which
1707
- represent |childBoxes |.
1707
+ 1 . Let |layoutChild | be the result of <a>get a layout child </a> given |workletGlobalScope|,
1708
+ |name|, and |childBox |.
1708
1709
1709
- The {{LayoutChild/styleMap}} on each {{LayoutChild}} should be a new
1710
- {{StylePropertyMapReadOnly}} populated with <em> only</em> the <a>computed values</a> for
1711
- properties listed in |childInputProperties|.
1710
+ 2. <a for=list>Append</a> |layoutChild| to |children|.
1712
1711
1713
1712
6. Let |edges| be a new {{LayoutEdgeSizes}} populated with the <a>computed value</a> for all the
1714
1713
<a>box model edges</a> for |box|.
1715
1714
1716
1715
7. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em> only</em> the
1717
1716
<a>computed values</a> for properties listed in |inputProperties| for |box|.
1718
1717
1718
+ Issue: We may want to store |styleMap| on |box| instead, similar to |layoutInstance|.
1719
+
1719
1720
8. At this stage the user agent may re-use the <a>intrinsic sizes</a> from a previous invocation
1720
1721
if |children|, |styleMap| are equivalent to that previous invocation. If so let the
1721
1722
intrinsic sizes the cached intrinsic sizes and abort all these steps.
@@ -1813,23 +1814,22 @@ following steps:
1813
1814
If <a>get a layout definition</a> returned failure, let the |box| fallback to the <a>flow
1814
1815
layout</a> and abort all these steps.
1815
1816
1816
- 2. Let |layoutInstance| be the result of <a>get a layout class instance</a> given |name|, | box|,
1817
+ 2. Let |layoutInstance| be the result of <a>get a layout class instance</a> given |box|,
1817
1818
|definition|, |workletGlobalScope|.
1818
1819
1819
1820
If <a>get a layout class instance</a> returned failure, let the |box| fallback to the
1820
1821
<a>flow layout</a> and abort all these steps.
1821
1822
1822
1823
3. Let |inputProperties| be |definition|'s <a for="layout definition">input properties</a> .
1823
1824
1824
- 4. Let |childInputProperties| be |definition|'s <a for="layout definition">child input
1825
- properties</a> .
1825
+ 4. Let |children| be a new <a>list</a> .
1826
1826
1827
- 5. Let |children| be a new <a>list</a> populated with new {{LayoutChild}} objects which
1828
- represent |childBoxes|.
1827
+ 5. <a for=list>For each</a> |childBox| in |childBoxes| perform the following substeps:
1829
1828
1830
- The {{LayoutChild/styleMap}} on each {{LayoutChild}} should be a new
1831
- {{StylePropertyMapReadOnly}} populated with <em> only</em> the <a>computed values</a> for
1832
- properties listed in |childInputProperties|.
1829
+ 1. Let |layoutChild| be the result of <a>get a layout child</a> given |workletGlobalScope|,
1830
+ |name|, and |childBox|.
1831
+
1832
+ 2. <a for=list>Append</a> |layoutChild| to |children|.
1833
1833
1834
1834
6. Let |edges| be a new {{LayoutEdgeSizes}} populated with the <a>computed value</a> for all the
1835
1835
<a>box model edges</a> for |box|.
@@ -1840,6 +1840,8 @@ following steps:
1840
1840
8. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em> only</em> the
1841
1841
<a>computed values</a> for properties listed in |inputProperties| for |box|.
1842
1842
1843
+ Issue: We may want to store |styleMap| on |box| instead, similar to |layoutInstance|.
1844
+
1843
1845
9. Let |breakToken| be a new {{BreakToken}} populated with the appropriate information from
1844
1846
|internalBreakToken|.
1845
1847
@@ -1930,18 +1932,17 @@ When the user agent wants to <dfn>get a layout definition</dfn> given |name|, an
1930
1932
</div>
1931
1933
1932
1934
<div algorithm="get a layout class instance">
1933
- When the user agent wants to <dfn>get a layout class instance</dfn> given |name|, |box|,
1934
- |definition|, and |workletGlobalScope|, it <em> must</em> run the following steps:
1935
-
1936
- 1. Let |layoutClassInstanceMap| be |workletGlobalScope|'s <a>layout class instances</a> map.
1935
+ When the user agent wants to <dfn>get a layout class instance</dfn> given |box|, |definition|, and
1936
+ |workletGlobalScope|, it <em> must</em> run the following steps:
1937
1937
1938
- 2 . Let |key | be a stable <a for=map>key </a> which is unique to |box| and |name| .
1938
+ 1 . Let |layoutClassInstanceMap | be |box|'s <a>layout class instances </a> map .
1939
1939
1940
- 3. Let |layoutInstance| be the result of <a>get</a> |layoutClassInstanceMap|[|key|] . If
1941
- |layoutInstance| is null, run the following steps:
1940
+ 2. Let |layoutInstance| be the result of <a>get</a>
1941
+ |layoutClassInstanceMap|[|workletGlobalScope|] . If |layoutInstance| is null, run the
1942
+ following steps:
1942
1943
1943
- 1. If the <a>constructor valid flag</a> on |definition| is false, let |box| fallback to the
1944
- <a>flow layout</a> and a abort all these steps.
1944
+ 1. If the <a>constructor valid flag</a> on |definition| is false, then return failure and
1945
+ abort all these steps.
1945
1946
1946
1947
2. Let |layoutCtor| be the <a>class constructor</a> on |definition|.
1947
1948
@@ -1950,7 +1951,7 @@ When the user agent wants to <dfn>get a layout class instance</dfn> given |name|
1950
1951
If <a>construct</a> throws an exception, set the |definition|'s <a>constructor valid
1951
1952
flag</a> to false, then return failure and abort all these steps.
1952
1953
1953
- 4. <a for=map>Set</a> |layoutClassInstanceMap|[|key |] to |layoutInstance|.
1954
+ 4. <a for=map>Set</a> |layoutClassInstanceMap|[|workletGlobalScope |] to |layoutInstance|.
1954
1955
1955
1956
4. Return |layoutInstance|.
1956
1957
</div>
0 commit comments