@@ -502,6 +502,9 @@ The {{LayoutChild}} has internal slot(s):
502
502
api context=] . This slot is used so that a {{LayoutChild}} used outside the current layout
503
503
pass is invalid.
504
504
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
+
505
508
<div class=example>
506
509
The example below shows the basic usage of a {{LayoutChild}} .
507
510
<pre class='lang-javascript'>
@@ -583,11 +586,32 @@ engines to perform text shaping across element boundaries.
583
586
</pre>
584
587
</div>
585
588
589
+ Note: When accessing the {{LayoutChild/styleMap}} the user agent can create a new
590
+ {{StylePropertyMapReadOnly}} if none exists yet.
591
+
586
592
<div algorithm>
587
593
The <dfn attribute for=LayoutChild>styleMap</dfn> , on getting from a {{LayoutChild}} |this|, the
588
594
user agent must perform the following steps:
589
595
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.
591
615
</div>
592
616
593
617
Note: 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
715
739
When a [=box=] is removed from the [=box tree=] the user agent <em> must</em> clear the
716
740
{{[[layoutChildMap]]}} .
717
741
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
+
718
750
<div algorithm="update a layout child style">
719
751
When the user agent wants to <dfn>update a layout child style</dfn> given |box|, it <em> must</em>
720
752
run the following steps:
@@ -729,13 +761,9 @@ run the following steps:
729
761
730
762
4. <a for=map>For each</a> |layoutChild| in |layoutChildMap|:
731
763
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.
735
765
</div>
736
766
737
- Issue: Probably change the above algorithm, and just clear the styleMap internal slot instead.
738
-
739
767
When the computed style of a [=box=] changes the user agent must run the [=update a layout child
740
768
style=] algorithm.
741
769
@@ -2114,7 +2142,7 @@ When the user agent wants to <dfn>run a work queue</dfn> given |promise|, and |w
2114
2142
2115
2143
1. Let |childConstraints| be |task|'s [=layout api work task/layout constraints=] .
2116
2144
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= ] .
2118
2146
2119
2147
3. Let |targetRealm| be |layoutChild|'s [=Realm=] .
2120
2148
0 commit comments