Skip to content

Commit 2c93173

Browse files
committed
[css-layout-api] Add section specifying constraints on global scope selection.
1 parent b5ab497 commit 2c93173

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

css-layout-api/Overview.bs

+20-16
Original file line numberDiff line numberDiff line change
@@ -1783,14 +1783,8 @@ context=] for a given |box|, |childBoxes| it <em>must</em> run the following ste
17831783
steps.
17841784

17851785
4. Let |workletGlobalScope| be a {{LayoutWorkletGlobalScope}} from the list of [=worklet's
1786-
WorkletGlobalScopes=] from the layout {{Worklet}}.
1787-
1788-
The user agent <em>must</em> have, and select from at least two
1789-
{{LayoutWorkletGlobalScope}}s in the [=worklet's WorkletGlobalScopes=] [=list=], unless the
1790-
user agent is under memory constraints.
1791-
1792-
Note: This is to ensure that authors do not rely on being able to store state on the global
1793-
object or non-regeneratable state on the class.
1786+
WorkletGlobalScopes=] from the layout {{Worklet}}, following the rules defined in
1787+
[[#global-scope-selection]].
17941788

17951789
The user agent <em>may</em> also [=create a WorkletGlobalScope=] at this time, given the
17961790
layout {{Worklet}}.
@@ -1902,14 +1896,8 @@ it <em>must</em> run the following steps:
19021896
steps.
19031897

19041898
4. Let |workletGlobalScope| be a {{LayoutWorkletGlobalScope}} from the list of [=worklet's
1905-
WorkletGlobalScopes=] from the layout {{Worklet}}.
1906-
1907-
The user agent <em>must</em> have, and select from at least two
1908-
{{LayoutWorkletGlobalScope}}s in the [=worklet's WorkletGlobalScopes=] [=list=], unless the
1909-
user agent is under memory constraints.
1910-
1911-
Note: This is to ensure that authers do not rely on being able to store state on the global
1912-
object or non-regeneratable state on the class.
1899+
WorkletGlobalScopes=] from the layout {{Worklet}}, following the rules defined in
1900+
[[#global-scope-selection]].
19131901

19141902
The user agent <em>may</em> also [=create a WorkletGlobalScope=] at this time, given the
19151903
layout {{Worklet}}.
@@ -2037,6 +2025,22 @@ following steps:
20372025

20382026
</div>
20392027

2028+
### Global Scope Selection ### {#global-scope-selection}
2029+
2030+
When the user agent needs to select a {{LayoutWorkletGlobalScope}} from the layout [=worklet's
2031+
WorkletGlobalScopes=] [=list=] it <em>must</em>:
2032+
2033+
- Select from at <em>least</em> two {{LayoutWorkletGlobalScope}}s, unless the user agent is
2034+
under memory constraints.
2035+
2036+
- <em>Not</em> re-use the same {{LayoutWorkletGlobalScope}} more than 1000 times in a row.
2037+
2038+
Note: The 1000 limit was picked as a high upper bound, this limit may improve (downwards)
2039+
over time.
2040+
2041+
Note: These rules exist to ensure that authors do not rely on being able to store state on the
2042+
global object or non-regeneratable state on the class. See [[worklets-1#code-idempotency]].
2043+
20402044
### Utility Algorithms ### {#utility-algorithms}
20412045

20422046
The section specifies algorithms common to the [=determine the intrinsic sizes=] and [=generate

0 commit comments

Comments
 (0)