@@ -3869,178 +3869,3 @@ Changes</h2>
38693869 A partial <a href="http://dev.w3.org/csswg/css-grid-1/issues-wd-20150805">Disposition of Comments</a> is available.
38703870
38713871 See also <a href="http://www.w3.org/TR/2015/WD-css-grid-1-20150806/#changes">previous changes</a> .
3872-
3873- <h2 class="no-num" id="translated-algo">
3874- Appendix A: Translated Layout Algorithm</h2>
3875-
3876- Note: The following is a more direct translation of the
3877- <a href="http://www.w3.org/TR/2014/WD-css-grid-1-20140123/#track-sizing-algorithm">original Microsoft editors' track sizing algorithm</a> ,
3878- from which the current algorithm is derived.
3879- It follows the original algorithm structure
3880- without being as programmatic in its language.
3881- It is preserved here to aid in review of the current specification
3882- (and will be removed in the next revision).
3883-
3884- This algorithm is run multiple times,
3885- once for each set of <a>grid items</a> with a particular <a>span count</a> ,
3886- and each time it moves through four phases,
3887- each one addressing one combination of ''min-content'' or ''max-content''
3888- as a <a>min track sizing function</a> or <a>max track sizing function</a> .
3889-
3890- Starting from the set of all <a>grid items</a> in the grid,
3891- remove any with a <a>span count</a> greater than one
3892- which span a track with a <<flex>> <a>max track sizing function</a> .
3893- Of the remaining,
3894- sort them into groups according to their <a>span count</a> ,
3895- and order the groups in ascending order of <a>span count</a> .
3896- For each group, in order,
3897- perform the following steps four times:
3898-
3899- <ol>
3900- <li>
3901- <b> Initialize variables</b> .
3902-
3903- Let each item's <dfn>needed space</dfn> be:
3904-
3905- <dl class="phase">
3906- <dt> In phase 1
3907- <dd>
3908- The min-content size of the item,
3909- minus the sum of the <a>base sizes</a> of the grid tracks it spans.
3910- <dt> In phase 2
3911- <dd>
3912- The max-content size of the item,
3913- minus the sum of the <a>base sizes</a> of the grid tracks it spans.
3914- <dt> In phase 3
3915- <dd>
3916- The min-content size of the item,
3917- minus the sum of the <a>growth limits</a> of the grid tracks it spans
3918- (or, if the <a>growth limit</a> is infinite, the <a>base size</a> ).
3919- <dt> In phase 4
3920- <dd>
3921- The max-content size of the item,
3922- minus the sum of the <a>growth limits</a> of the grid tracks it spans
3923- (or, if the <a>growth limit</a> is infinite, the <a>base size</a> ).
3924- </dl>
3925-
3926- Let each item's <dfn>growable tracks</dfn> be:
3927-
3928- <dl class="phase">
3929- <dt> In phase 1
3930- <dd>
3931- The grid tracks it spans with a ''min-content'' or ''max-content'' <a>min track sizing function</a> .
3932- <dt> In phase 2
3933- <dd>
3934- The grid tracks it spans with a ''max-content'' <a>min track sizing function</a> .
3935- <dt> In phase 3
3936- <dd>
3937- The grid tracks it spans with a ''min-content'' or ''max-content'' <a>max track sizing function</a> .
3938- <dt> In phase 4
3939- <dd>
3940- The grid tracks it spans with a ''max-content'' <a>max track sizing function</a> .
3941- </dl>
3942-
3943- Let each item's <dfn>overgrowable tracks</dfn> be:
3944-
3945- <dl class="phase">
3946- <dt> In phase 1
3947- <dd>
3948- The item's <a>growable tracks</a> that also have a ''min-content'' or ''max-content'' <a>max track sizing function</a> .
3949- If there are no such tracks,
3950- then it's all the <a>growable tracks</a> .
3951- <dt> In phase 2
3952- <dd>
3953- The item's <a>growable tracks</a> that also have a ''max-content'' <a>max track sizing function</a> .
3954- If there ar eno such tracks,
3955- then it's all the <a>growable tracks</a> .
3956- <dt> In phase 3
3957- <dt> In phase 4
3958- <dd>
3959- The item's <a>growable tracks</a> .
3960- </dl>
3961-
3962- Let each track's <dfn>growth delta</dfn> initially be zero.
3963-
3964- <li>
3965- <b> Calculate growth deltas.</b>
3966-
3967- For each grid item in the group:
3968-
3969- <ol>
3970- <li>
3971- <dl class="phase">
3972- <dt> In phase 1
3973- <dt> In phase 2
3974- <dd>
3975- Let each track's <dfn>hypothetical size</dfn>
3976- be the track's <a>base size</a> .
3977- <dt> In phase 3
3978- <dt> In phase 4
3979- <dd>
3980- Let each track's <a>hypothetical size</a>
3981- be the track's <a>growth limit</a> if it's finite,
3982- or else the track's <a>base size</a> otherwise.
3983- </dl>
3984-
3985- <li>
3986- Distribute the item's <a>needed space</a>
3987- as evenly as possible among the <a>hypothetical sizes</a> of the item's <a>growable tracks</a> ,
3988- maxing each out as its <a>hypothetical size</a> reaches its <a>growth limit</a> .
3989-
3990- <dl class="phase">
3991- <dt> In phase 4
3992- <dd>
3993- If the track's <a>growth limit</a> was changed from infinite to a finite value
3994- in phase 3,
3995- treat its <a>growth limit</a> as infinite for the purposes of this step.
3996- </dl>
3997-
3998- <li>
3999- If all <a>growable tracks</a> reached their <a>growth limit</a> in the previous step
4000- and there is still <a>needed space</a> to distribute,
4001- distribute the leftover space evenly among the <a>hypothetical sizes</a> of the item's <a>overgrowable tracks</a> .
4002-
4003- <li>
4004- <dl class="phase">
4005- <dt> In phase 1
4006- <dt> In phase 2
4007- <dd>
4008- For each track,
4009- if the difference between its <a>hypothetical size</a> and its <a>base size</a>
4010- is greater than its <a>growth delta</a> ,
4011- set its <a>growth delta</a> to that difference.
4012- <dt> In phase 3
4013- <dt> In phase 4
4014- <dd>
4015- For each track,
4016- if its <a>growth limit</a> is finite,
4017- and the difference between its <a>hypothetical size</a> and its <a>growth limit</a>
4018- is greater than its <a>growth delta</a> ,
4019- set its <a>growth delta</a> to that difference.
4020- Otherwise, if its <a>growth limit</a> is infinite,
4021- and the difference between its <a>hypothetical size</a> and its <a>base size</a>
4022- is greater than its <a>growth delta</a> ,
4023- set its <a>growth delta</a> to that difference.
4024- </dl>
4025- </ol>
4026-
4027- <li>
4028- <b> Adjust each track's affected size.</b>
4029-
4030- <dl class="phase">
4031- <dt> In phase 1
4032- <dt> In phase 2
4033- <dd>
4034- For each track,
4035- increase its <a>base size</a> by its <a>growth delta</a> .
4036- <dt> In phase 3
4037- <dt> In phase 4
4038- <dd>
4039- For each track,
4040- if its <a>growth limit</a> is finite,
4041- increase its <a>growth limit</a> by its <a>growth delta</a> .
4042- Otherwise, if its <a>growth limit</a> is infinite,
4043- set its <a>growth limit</a>
4044- to the sum of its <a>base size</a> and its <a>growth delta</a> .
4045- </dl>
4046- </ol>
0 commit comments