Skip to content

Commit b5ab497

Browse files
committed
[css-layout-api] Make sure the styleMap passed into layout() is the same object.
1 parent 904c42e commit b5ab497

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

css-layout-api/Overview.bs

+27-8
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,24 @@ Each [=box=] representing a [=layout API container=] has a [=map=] of <dfn>layou
304304
instances</dfn>. Initially this map is empty; it is populated when the user agent calls either
305305
[=determine the intrinsic sizes=] or [=generate a fragment=] for a [=box=].
306306

307+
Each [=box=] representing a [=layout API container=] has a <dfn>styleMap</dfn> internal slot.
308+
This is a {{StylePropertyMapReadOnly}} which contains the properties listed in
309+
<code>inputProperties</code>.
310+
311+
The user agent <em>clear</em> the [=styleMap=] internal slot for a [=box=] when:
312+
313+
- The [=computed values=] of [=document layout definition/input properties=] for the [=box=]
314+
changes.
315+
316+
- When the [=box=] is removed from the [=box tree=].
317+
318+
- Every 1000 layout passes.
319+
320+
Note: The above rule exists to ensure that web developers do not rely on being able to store
321+
non-regeneratable state on the {{StylePropertyMapReadOnly}} object.
322+
The 1000 limit was picked as a high upper bound, this limit may improve (downwards) over
323+
time.
324+
307325
<div class='note'>
308326
Note: The shape of the class should be:
309327
<pre class='lang-javascript'>
@@ -742,9 +760,8 @@ When a [=box=] is removed from the [=box tree=] the user agent <em>must</em> cle
742760
The user agent <em>must</em> clear the {{[[layoutChildMap]]}} internal slot every 1000 layout
743761
passes.
744762

745-
Note: The above rule exists to ensure that web developers do not rely on being about to store
763+
Note: The above rule exists to ensure that web developers do not rely on being able to store
746764
non-regeneratable state on the {{LayoutChild}} object.
747-
748765
The 1000 limit was picked as a high upper bound, this limit may improve (downwards) over time.
749766

750767
<div algorithm="update a layout child style">
@@ -764,8 +781,8 @@ run the following steps:
764781
1. |layoutChild|'s {{[[styleMap]]}} to null.
765782
</div>
766783

767-
When the computed style of a [=box=] changes the user agent must run the [=update a layout child
768-
style=] algorithm.
784+
When the [=computed values=] of [=document layout definition/child input properties=] for a [=box=]
785+
changes the user agent must run the [=update a layout child style=] algorithm.
769786

770787
Layout Fragments {#layout-fragments}
771788
------------------------------------
@@ -2100,12 +2117,14 @@ When the user agent wants to <dfn>get a layout class instance</dfn> given |box|,
21002117
When the user agent wants to <dfn>get a style map</dfn> given |box|, and |inputProperties|, it
21012118
<em>must</em> run the following steps:
21022119

2103-
1. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em>only</em> the
2104-
[=computed values=] for properties listed in |inputProperties| for |box|.
2120+
1. If |box|'s [=styleMap=] is null, then:
2121+
2122+
1. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em>only</em> the
2123+
[=computed values=] for properties listed in |inputProperties| for |box|.
21052124

2106-
2. Return |styleMap|.
2125+
2. Set |box|'s [=styleMap=] internal slot to |styleMap|.
21072126

2108-
Issue: We may want to store |styleMap| on |box| instead.
2127+
2. Return |box|'s {{StylePropertyMapReadOnly}} contained in the [=styleMap=] internal slot.
21092128

21102129
</div>
21112130

0 commit comments

Comments
 (0)