@@ -1502,83 +1502,6 @@ Layout {#layout}
1502
1502
1503
1503
This section describes how the CSS Layout API interacts with the user agent's layout engine.
1504
1504
1505
- Layout Invalidation {#layout-invalidation}
1506
- ------------------------------------------
1507
-
1508
- Each <a>box</a> has an associated <dfn>layout valid flag</dfn> . It may be either
1509
- <dfn>layout-valid</dfn> or <dfn>layout-invalid</dfn> . It is initially set to <a>layout-invalid</a> .
1510
-
1511
- Each <a>box</a> has an associated <dfn>intrinsic sizes valid flag</dfn> . If may be either
1512
- <dfn>intrinsic-sizes-valid</dfn> or <dfn>intrinsic-sizes-invalid</dfn> . It is initially set to
1513
- <a>intrinsic-sizes-invalid</a> .
1514
-
1515
- <div algorithm>
1516
- When the user agent wants to <dfn>invalidate layout functions</dfn> given |box|, the user agent
1517
- <em> must</em> run the following steps:
1518
-
1519
- 1. Let |layoutFunction| be the ''layout()'' function of the 'display' property on the computed
1520
- style for the |box| if it exists. If it is a different type of value (e.g. ''grid'' ) then
1521
- abort all these steps.
1522
-
1523
- 2. Let |name| be the first argument of the |layoutFunction|.
1524
-
1525
- 3. Let |documentDefinition| be the result of <a>get a document layout definition</a> given
1526
- |name|.
1527
-
1528
- If <a>get a document layout definition</a> returned failure, or if |documentDefinition| is
1529
- <code> "invalid"</code> , then abort all these steps.
1530
-
1531
- 4. Let |inputProperties| be |documentDefinition|'s <a for="document layout definition">input
1532
- properties</a> .
1533
-
1534
- 5. Let |childInputProperties| be |documentDefinition|'s <a for="document layout
1535
- definition">child input properties</a> .
1536
-
1537
- 6. For each |property| in |inputProperties|, if the |property|'s <a>computed value</a> has
1538
- changed, set the <a>layout valid flag</a> on the <a>box</a> to <a>layout-invalid</a> , and
1539
- set the <a>intrinsic sizes valid flag</a> to <a>intrinsic-sizes-invalid</a> .
1540
-
1541
- 7. For each |property| in |childInputProperties|, if the |property|'s <a>computed value</a> has
1542
- changed, set the <a>layout valid flag</a> on the <a>box</a> to <a>layout-invalid</a> , and
1543
- set the <a>intrinsic sizes valid flag</a> to <a>intrinsic-sizes-invalid</a> .
1544
- </div>
1545
-
1546
- <a>Invalidate layout functions</a> <em> must</em> be run when the user agent recalculates the computed
1547
- style for a box, or when the children's computed style of that box is recalculated.
1548
-
1549
- When a child <a>box</a> represented by a {{LayoutChild}} is added or removed from the <a>box
1550
- tree</a> or has its layout invalidated (from a computed style change, or a descendant change),
1551
- <em> and</em> this invalidation is to be propagated up the box tree, set the <a>layout valid flag</a>
1552
- on the current <a>box</a> to <a>layout-invalid</a> and set the <a>intrinsic sizes valid flag</a> on
1553
- the current <a>box</a> to <a>intrinsic-sizes-invalid</a> .
1554
-
1555
- When the computed style of a <a>layout API container</a> changes, <em> and</em> this change effects
1556
- the values inside the {{LayoutEdges}} object, set the <a>layout valid flag</a> of the box to
1557
- <a>layout-invalid</a> , and set the <a>intrinsic sizes valid flag</a> of the box to
1558
- <a>intrinsic-sizes-invalid</a> .
1559
-
1560
- If the computed style changes effects the values inside the {{LayoutConstraints}} object, just set
1561
- the <a>intrinsic sizes valid flag</a> of the box to <a>intrinsic-sizes-invalid</a> .
1562
-
1563
- Note: As the {{LayoutConstraints}} object is only passed into the layout function there is no need
1564
- to invalidate the intrinsic sizes.
1565
-
1566
- <div class="note">
1567
- Note: As an example the following properties could change the {{LayoutEdges}} object:
1568
- - 'padding-top'
1569
- - 'border-left-width'
1570
- - 'overflow-y'
1571
-
1572
- And the following properties could change the {{LayoutConstraints}} object:
1573
- - 'width'
1574
- - 'max-width'
1575
- - 'height'
1576
- </div>
1577
-
1578
- Note: This only describes layout invalidation as it relates to the CSS Layout API. All
1579
- <a>boxes</a> conceptually have a <a>layout valid flag</a> and these changes are propagated
1580
- through the <a>box tree</a> .
1581
-
1582
1505
Performing Layout {#performing-layout}
1583
1506
--------------------------------------
1584
1507
@@ -1614,24 +1537,16 @@ context</a> for a given |box|, |childBoxes| it <em>must</em> run the following s
1614
1537
1. Let |layoutFunction| be the ''layout()'' for the <a>computed value</a> of <<display-inside>>
1615
1538
for |box|.
1616
1539
1617
- 2. If the <a>intrinsic sizes valid flag</a> for the |layoutFunction| is
1618
- <a>intrinsic-sizes-valid</a> the user agent <em> may</em> use the intrinsic sizes from the
1619
- previous invocation. If so it <em> may</em> abort all these steps and use the previous value
1620
- for the intrinsic sizes.
1621
-
1622
- 3. Set the <a>intrinsic sizes valid flag</a> for the |layoutFunction| to
1623
- <a>intrinsic-sizes-valid</a> .
1624
-
1625
- 4. Let |name| be the first argument of the |layoutFunction|.
1540
+ 2. Let |name| be the first argument of the |layoutFunction|.
1626
1541
1627
- 5 . Let |documentDefinition| be the result of <a>get a document layout definition</a> given
1542
+ 3 . Let |documentDefinition| be the result of <a>get a document layout definition</a> given
1628
1543
|name|.
1629
1544
1630
1545
If <a>get a document layout definition</a> returned failure, or if |documentDefinition| is
1631
1546
<code> "invalid"</code> , then let |box| fallback to the <a>flow layout</a> and abort all
1632
1547
these steps.
1633
1548
1634
- 6 . Let |workletGlobalScope| be a {{LayoutWorkletGlobalScope}} from the list of <a>worklet's
1549
+ 4 . Let |workletGlobalScope| be a {{LayoutWorkletGlobalScope}} from the list of <a>worklet's
1635
1550
WorkletGlobalScopes</a> from the layout {{Worklet}} .
1636
1551
1637
1552
The user agent <em> must</em> have, and select from at least two
@@ -1644,7 +1559,7 @@ context</a> for a given |box|, |childBoxes| it <em>must</em> run the following s
1644
1559
The user agent <em> may</em> also <a>create a WorkletGlobalScope</a> at this time, given the
1645
1560
layout {{Worklet}} .
1646
1561
1647
- 7 . Run <a>invoke a intrinsic sizes callback</a> given |name|, |box|, |childBoxes|, and
1562
+ 5 . Run <a>invoke a intrinsic sizes callback</a> given |name|, |box|, |childBoxes|, and
1648
1563
|workletGlobalScope| optionally <a>in parallel</a> .
1649
1564
1650
1565
Note: If the user agent runs <a>invoke a intrinsic sizes callback</a> on a thread <a>in
@@ -1735,22 +1650,16 @@ context</a> for a given |box|, |childBoxes|, |internalLayoutConstraints|, and an
1735
1650
1. Let |layoutFunction| be the ''layout()'' for the <a>computed value</a> of <<display-inside>>
1736
1651
for |box|.
1737
1652
1738
- 2. If the <a>layout valid flag</a> for the |layoutFunction| is <a>layout-valid</a> the user
1739
- agent <em> may</em> use the intrinsic sizes from the previous invocation. If so it
1740
- <em> may</em> abort all these steps and use the previous value for the intrinsic sizes.
1741
-
1742
- 3. Set the <a>layout valid flag</a> for the |layoutFunction| to <a>layout-valid</a> .
1743
-
1744
- 4. Let |name| be the first argument of the |layoutFunction|.
1653
+ 2. Let |name| be the first argument of the |layoutFunction|.
1745
1654
1746
- 5 . Let |documentDefinition| be the result of <a>get a document layout definition</a> given
1655
+ 3 . Let |documentDefinition| be the result of <a>get a document layout definition</a> given
1747
1656
|name|.
1748
1657
1749
1658
If <a>get a document layout definition</a> returned failure, or if |documentDefinition| is
1750
1659
<code> "invalid"</code> , then let |box| fallback to the <a>flow layout</a> and abort all
1751
1660
these steps.
1752
1661
1753
- 6 . Let |workletGlobalScope| be a {{LayoutWorkletGlobalScope}} from the list of <a>worklet's
1662
+ 4 . Let |workletGlobalScope| be a {{LayoutWorkletGlobalScope}} from the list of <a>worklet's
1754
1663
WorkletGlobalScopes</a> from the layout {{Worklet}} .
1755
1664
1756
1665
The user agent <em> must</em> have, and select from at least two
@@ -1763,7 +1672,7 @@ context</a> for a given |box|, |childBoxes|, |internalLayoutConstraints|, and an
1763
1672
The user agent <em> may</em> also <a>create a WorkletGlobalScope</a> at this time, given the
1764
1673
layout {{Worklet}} .
1765
1674
1766
- 7 . Run <a>invoke a layout callback</a> given |name|, |box|, |childBoxes|,
1675
+ 5 . Run <a>invoke a layout callback</a> given |name|, |box|, |childBoxes|,
1767
1676
|internalLayoutConstraints|, |internalBreakToken|, and |workletGlobalScope| optionally <a>in
1768
1677
parallel</a> .
1769
1678
0 commit comments