@@ -502,6 +502,9 @@ The {{LayoutChild}} has internal slot(s):
502502 api context=] . This slot is used so that a {{LayoutChild}} used outside the current layout
503503 pass is invalid.
504504
505+ The {{LayoutChild/[[styleMap]]}} may be pre-populated when the [=computed value=] for properties
506+ listed in the in [=layout definition/child input properties=] for the {{LayoutChild/[[box]]}} .
507+
505508<div class=example>
506509The example below shows the basic usage of a {{LayoutChild}} .
507510<pre class='lang-javascript'>
@@ -583,11 +586,32 @@ engines to perform text shaping across element boundaries.
583586 </pre>
584587</div>
585588
589+ Note: When accessing the {{LayoutChild/styleMap}} the user agent can create a new
590+ {{StylePropertyMapReadOnly}} if none exists yet.
591+
586592<div algorithm>
587593The <dfn attribute for=LayoutChild>styleMap</dfn> , on getting from a {{LayoutChild}} |this|, the
588594user agent must perform the following steps:
589595
590- 1. Return |this|' {{StylePropertyMapReadOnly}} contained in the {{[[styleMap]]}} internal slot.
596+ 1. If |this|' {{[[styleMap]]}} is null, then:
597+
598+ 1. Let |box| be |this|' {{LayoutChild/[[box]]}} .
599+
600+ 2. Let |definition| be the result of [=get a layout definition=] .
601+
602+ 3. Let |childInputProperties| be |definition|'s [=layout definition/child input
603+ properties=] .
604+
605+ 4. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em> only</em> the
606+ [=computed values=] for properties listed in |childInputProperties| for |box|.
607+
608+ 5. Set |this|' {{LayoutChild/[[styleMap]]}} internal slot to |styleMap|.
609+
610+ Note: If the user agent always pre-populates {{LayoutChild/[[styleMap]]}} then this branch
611+ of the algorithm won't be reached.
612+
613+ 2. Return |this|' {{StylePropertyMapReadOnly}} contained in the {{LayoutChild/[[styleMap]]}}
614+ internal slot.
591615</div>
592616
593617Note: The {{intrinsicSizes()}} method allows the web developer to query the intrinsic sizes of the
@@ -715,6 +739,14 @@ When a [=box=] is inserted into the [=box tree=] the user agent <em>may</em> pre
715739When a [=box=] is removed from the [=box tree=] the user agent <em> must</em> clear the
716740{{[[layoutChildMap]]}} .
717741
742+ The user agent <em> must</em> clear the {{[[layoutChildMap]]}} internal slot every 1000 layout
743+ passes.
744+
745+ Note: The above rule exists to ensure that web developers do not rely on being about to store
746+ non-regeneratable state on the {{LayoutChild}} object.
747+
748+ The 1000 limit was picked as a high upper bound, this limit may improve (downwards) over time.
749+
718750<div algorithm="update a layout child style">
719751When the user agent wants to <dfn>update a layout child style</dfn> given |box|, it <em> must</em>
720752run the following steps:
@@ -729,13 +761,9 @@ run the following steps:
729761
730762 4. <a for=map>For each</a> |layoutChild| in |layoutChildMap|:
731763
732- 1. Let |styleMap| be |layoutChild|'s {{[[styleMap]]}} .
733-
734- 2. Update |styleMap|'s [=declarations=] based on the |box|' s new computed style.
764+ 1. |layoutChild|'s {{[[styleMap]]}} to null.
735765</div>
736766
737- Issue: Probably change the above algorithm, and just clear the styleMap internal slot instead.
738-
739767When the computed style of a [=box=] changes the user agent must run the [=update a layout child
740768style=] algorithm.
741769
@@ -2114,7 +2142,7 @@ When the user agent wants to <dfn>run a work queue</dfn> given |promise|, and |w
21142142
21152143 1. Let |childConstraints| be |task|'s [=layout api work task/layout constraints=] .
21162144
2117- 2. Let |childBreakToken| be |task|'s [=layout api work task/= child break token].
2145+ 2. Let |childBreakToken| be |task|'s [=layout api work task/child break token= ] .
21182146
21192147 3. Let |targetRealm| be |layoutChild|'s [=Realm=] .
21202148
0 commit comments