@@ -3639,31 +3639,37 @@ Grid Container Baselines</h3>
3639
3639
3640
3640
<ol>
3641
3641
<li>
3642
- If any of the <a>grid items</a> whose areas intersect the <a>grid container</a> ’s first (last) row
3643
- participate in <a>baseline alignment</a> ,
3642
+ If the [=grid container=] does not contain any [=grid items=] ,
3643
+ the grid container has no first (last) <a>baseline set</a> ,
3644
+ and one is <a lt="synthesize baselines">synthesized</a> if needed
3645
+ according to the rules of its <a>alignment context</a> .
3646
+ Exit from this algorithm.
3647
+
3648
+ <li>
3649
+ Otherwise,
3650
+ find the first (last) row of the [=grid container=]
3651
+ containing at least one [=grid item=] .
3652
+
3653
+ If any of the [=grid items=] intersecting this row
3654
+ participate in [=baseline alignment=] ,
3644
3655
the grid container's <a>baseline set</a>
3645
3656
is <a lt="generate baselines">generated</a> from
3646
3657
the shared <a>alignment baseline</a> of those <a>grid items</a> .
3647
3658
3648
- <li>
3649
- Otherwise, if the grid container has at least one <a>grid item</a> ,
3659
+ Otherwise,
3650
3660
the grid container's first (last) baseline set
3651
3661
is <a lt="generate baselines">generated</a> from
3652
3662
the <a>alignment baseline</a> of the first (last) <a>grid item</a>
3653
- in row-major <a>grid order</a> (according to the <a>writing mode</a> of the <a>grid container</a> ).
3654
- If the item has no <a>alignment baseline</a> in the grid's inline axis,
3663
+ in <a>grid order</a> (according to the <a>writing mode</a> of the <a>grid container</a> ).
3664
+ If the [=grid item=] has no <a>alignment baseline</a> in the grid's inline axis,
3655
3665
then one is first <a lt="synthesize baselines">synthesized</a>
3656
3666
from its border edges.
3657
-
3658
- <li>
3659
- Otherwise, the grid container has no first (last) <a>baseline set</a> ,
3660
- and one is <a lt="synthesize baselines">synthesized</a> if needed
3661
- according to the rules of its <a>alignment context</a> .
3662
3667
</ol>
3663
3668
3664
3669
<dfn export lt="grid order|grid-modified document order">Grid-modified document order (grid order)</dfn>
3665
3670
is the order in which <a>grid items</a> are encountered
3666
- when traversing the grid's <a>grid cells</a> .
3671
+ when traversing the grid's <a>grid cells</a>
3672
+ in row-major order.
3667
3673
If two items are encountered at the same time,
3668
3674
they are taken in <a>order-modified document order</a> .
3669
3675
0 commit comments