@@ -632,6 +632,9 @@ Grid Axis Track Sizing</h3>
632
632
* All items with an [=automatic grid position=] contribute
633
633
(regardless of whether they are ultimately placed in that track).
634
634
635
+ ISSUE(10053): Subgrids need special handling in order to avoid excessive performance costs.
636
+
637
+
635
638
<div class="example">
636
639
For example, suppose there are two columns in the [=grid axis=]
637
640
and that
@@ -675,6 +678,51 @@ Grid Axis Track Sizing</h3>
675
678
or all items are the same size
676
679
(or matching multiples of that size, in the case of spanning items).
677
680
681
+ <h4 id="track-sizing-performance">
682
+ Optimized Track Sizing</h4>
683
+
684
+ Track sizing can be optimized by aggregating items
685
+ that have the same span size and placement
686
+ into a single virtual item
687
+ as follows:
688
+
689
+ <ol>
690
+ <li>
691
+ Separate all the [=masonry items=] into <dfn>item groups</dfn> , according to the following properties:
692
+
693
+ * the span of the item
694
+ * the placement of the item, i.e. whether it an [=automatic grid position=] , or a [=definite grid position=] --
695
+ and if so, what that definite position is
696
+ * the item's [=baseline-sharing group=]
697
+
698
+ Note: For example, an item with span 2 placed in the second track
699
+ will be in a different group than an item with span 2 that has an [=automatic grid position=] .
700
+
701
+ ISSUE(10053): Subgrids need special handling in order to avoid excessive performance costs.
702
+
703
+ <li>
704
+ For each [=item group=] , synthesize a <dfn>virtual masonry item</dfn>
705
+ that has the maximum of every intrinsic size contribution
706
+ among the items in that group.
707
+
708
+ If the items apply [=baseline alignment=] ,
709
+ determine the baselines of the [=virtual masonry item=]
710
+ by placing all of its items into a single hypothetical grid track
711
+ and finding their shared baseline(s) and shims.
712
+ Increase the group's intrinsic size contributions accordingly.
713
+
714
+ <li>
715
+ Place hypothetical copies of each [=virtual masonry item=] into the [=grid axis=] tracks
716
+ in every position that the item could potentially occupy,
717
+ and run the [[css-grid-2#algo-track-sizing|track sizing algorithm]] with those items.
718
+ The resulting track sizes are the [=masonry container's=] track sizes.
719
+ </ol>
720
+
721
+ Note: This optimization should give the same results
722
+ as the track sizing description [[#track-sizing|above]] ;
723
+ if not this is an error, please
724
+ <a href="https://github.com/w3c/csswg-drafts/issues">report it to the CSSWG</a> .
725
+
678
726
<h2 id="masonry-track-placement">
679
727
Masonry Placement</h3>
680
728
0 commit comments