You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li>Add margin-box hypothetical main sizes of all items, <i>adjusted for min/max</i>.
1232
-
1233
-
<li>If the sum is less than available space, use positive flexibility, otherwise use negative flexibility.</li>
1234
-
</ol>
1235
-
1236
-
<p>for the rest of the algorithm use flexibility with the sign determined in this step</p>
1237
-
</li>
1238
-
1239
-
<li>Reset all flexible sizes to their preferred size</li>
1240
-
1241
-
<li>Find free space by subtracting sum of margin-box main sizes of
1242
-
flexbox items from available space.</li>
1229
+
<strong>Determine the used flexibility.</strong>
1230
+
Sum the hypothetical outer main sizes of all items on the line,
1231
+
clamped by their min and max main size properties.
1232
+
If the sum is greater than the flexbox's inner main size,
1233
+
use positive flexibility;
1234
+
otherwise, use negative flexibility.
1243
1235
1244
1236
<li>
1245
-
Distribute free space proportional to flex:
1246
-
1247
-
<ol>
1248
-
<li>If the free space is positive, but step 1 chose negative flexibility, do nothing</li>
1249
-
1250
-
<li>If the free space is negative, but step 1 chose positive flexibility, do nothing</li>
1237
+
<strong>Calculate free space.</strong>
1238
+
Sum the hypothetical outer main sizes of all items on the line
1239
+
(not clamping this time),
1240
+
and subtract this from the flexbox's inner main size.
1241
+
This is the free space.
1251
1242
1252
-
<li>Add a portion of free space to each flexible item,
1253
-
proportional to item's flexibility</li>
1254
-
</ol>
1255
-
</li>
1243
+
<li>
1244
+
<strong>Distribute free space proportional to flexibility.</strong>
1245
+
If the sign of the free space matches the sign of the flexibility,
1246
+
distribute the free space to each flexible item's main size
1247
+
in proportion to the item's flexibility.
1256
1248
1257
1249
<li>
1258
-
Fix min/max violations:
1259
-
1260
-
<ol>
1261
-
<li>Adjust each flexible item for min/max. </li>
1262
-
1263
-
<li>If the size has changed, it is a violation. </li>
1264
-
1265
-
<li>The violation may be positive (min violation) or negative (max violation). Accumulate the difference.</li>
1266
-
</ol>
1267
-
</li>
1250
+
<strong>Fix min/max violations.</strong>
1251
+
Clamp each item's main size by its min and max main size properties.
1252
+
If the item's main size was made smaller by this, it's a max violation.
1253
+
If the item's main size was made larger by this, it's a min violation.
1268
1254
1269
1255
<li>
1270
-
If the sum of all violations is:
1256
+
The total violation is the sum of the differences between
1257
+
each violating element's original size and its adjusted size.
1258
+
If the total violation is:
1271
1259
1272
1260
<dl>
1273
-
<dt>Zero</dt>
1274
-
<dd>Exit the algorithm.</dd>
1275
-
1276
-
<dt>Positive</dt>
1277
-
<dd>Freeze items with max violations, and return to step 2.</dd>
1278
-
1279
-
<dt>Negative</dt>
1280
-
<dd>Freeze items with min violations, and return to step 2.</dd>
1261
+
<dt>Zero
1262
+
<dd>
1263
+
Exit the algorithm.
1264
+
1265
+
<dt>Positive
1266
+
<dd>
1267
+
Freeze all the items with max violations,
1268
+
reset all other items to their preferred size,
1269
+
and return to step 2.
1270
+
1271
+
<dt>Negative
1272
+
<dd>
1273
+
Freeze all the items with min violations,
1274
+
reset all other items to their preferred size,
1275
+
and return to step 2.
1281
1276
</dl>
1282
-
</li>
1283
1277
</ol>
1284
-
1285
-
<p>For the purposes of this algorithm, measurements are considered <dfn>definite</dfn> if their precise value is known before the start of the algorithm.
1286
-
For example, sizes in pixels or inches are always definite; 'auto' and percent may or may not be definite,
1287
-
which depends on how these values were handled before this algorithm is
0 commit comments