Skip to content

Commit 146f1fc

Browse files
committed
Hopefully finish up the last part of the pagination algo.
1 parent da9c2de commit 146f1fc

2 files changed

Lines changed: 87 additions & 74 deletions

File tree

css3-flexbox/Overview.html

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,11 +2419,12 @@ <h2 id=pagination><span class=secno>10. </span> Page breaks in flexbox</h2>
24192419
and the flexbox is not at the top of the page already, move the
24202420
flexbox to the next page and restart flexbox layout entirely.
24212421

2422-
<li> If there are any flexbox items not laid out by the previous step,
2422+
<li> If there are any flexbox items not laid out by the first step,
24232423
rerun the flexbox sizing algorithm from <a href="#main-sizing">Main
24242424
Sizing Determination</a> through <a href="#cross-sizing">Cross Sizing
2425-
Determination</a>, and return to the previous step, starting from the
2426-
first item not already laid out.
2425+
Determination</a> using only the items not laid out on a previous
2426+
line, and return to the previous step, starting from the first item
2427+
not already laid out.
24272428
</ol>
24282429

24292430
<li> If there are any flexbox items not laid out by the previous step,
@@ -2464,14 +2465,14 @@ <h2 id=pagination><span class=secno>10. </span> Page breaks in flexbox</h2>
24642465
<li> For each item, lay out as much of its contents as will fit in the
24652466
space left on the page, and fragment the remaining content onto the
24662467
next page, rerunning the flexbox sizing algorithm from <a
2467-
href="#line-sizing">Line Sizing Determination</a> through <a
2468+
href="#line-sizing">Line Length Determination</a> through <a
24682469
href="#main-alignment">Main-Axis Alignment</a> into the new page size
24692470
using <em>all</em> the contents (including items completed on previous
24702471
pages).
24712472
<p class=note> Any flexbox items that fit entirely into previous
24722473
fragments still take up space in the main axis in later fragments.
24732474

2474-
<li> For each fragment of the flexbox, continue the flexbox layout
2475+
<li> For each fragment of the flexbox, rerun the flexbox layout
24752476
algorithm from <a href="#cross-alignment">Cross-Axis Alignment</a> to
24762477
its finish. For all fragments besides the first, treat &lsquo;<a
24772478
href="#flex-item-align"><code
@@ -2492,52 +2493,42 @@ <h2 id=pagination><span class=secno>10. </span> Page breaks in flexbox</h2>
24922493

24932494
<dd>
24942495
<ol>
2495-
<li>Collect items into lines and determine line heights:
2496-
<ol>
2497-
<li>
2498-
<p>If &lsquo;<a href="#flex-line-pack0"><code
2499-
class=property>flex-line-pack</code></a>&rsquo; is &lsquo;<code
2500-
class=property>stretch</code>&rsquo; and flexbox size in block
2501-
direction is definite, layout of the complete flexbox has to be done
2502-
first to determine line heights. Layout is done as usual for
2503-
non-paginated case, but accounting for forced breaks.
2504-
2505-
<p>If page size varies, this step may have to be redone, again with
2506-
complete content; special consideration should be to be given to
2507-
line breaks to ensure that item at the start of current page is also
2508-
at the start of a line in this hypothetical layout. This
2509-
specification currently doesn't define how exactly to achieve that.
2510-
2511-
<li>Otherwise, items are collected into lines and each line is laid
2512-
out as a single-line flexbox to determine block-direction size of
2513-
each line.
2514-
</ol>
2515-
2516-
<li>Lines are added one at a time, until out of available space or a
2517-
forced break is encountered
2496+
<li> Run the flexbox sizing algorithm (without regards to pagination),
2497+
through <a href="#cross-sizing">Cross Sizing Determination</a>.
25182498

2519-
<li>Breaks inside items (forced or unforced) are not allowed.
2499+
<li> Lay out as many flexbox lines as possible (but at least one),
2500+
starting from the first, until there is no more room on the page or a
2501+
forced break is encountered.
2502+
<p> If a line doesn't fit on the page, and the line is not at the top
2503+
of the page, move the line to the next page and restart the flexbox
2504+
layout algorithm entirely, using only the items in and following this
2505+
line.
2506+
2507+
<p> If a flexbox item itself causes a forced break, rerun the flexbox
2508+
layout algorithm from <a href="#main-sizing">Main Sizing
2509+
Determination</a> through <a href="#main-alignment">Main-Axis
2510+
Alignment</a>, using only the items on this and following lines, but
2511+
with the item causing the break automatically starting a new line in
2512+
the <a href="#algo-line-break"> step, then continue with this step.
2513+
Forced breaks <em>within</em> flexbox items are ignored. </a>
25202514

2521-
<li>If the first flexbox line on a page doesn't fit in cross-axis,
2522-
<ol>
2523-
<li>If the flexbox is not at the top of the page, it is moved to the
2524-
next page.
2525-
2526-
<li>If the flexbox is already at the top of the page, the item may
2527-
produce overflow. If &lsquo;<code
2528-
class=property>overflow</code>&rsquo; property of the flexbox is set
2529-
to &lsquo;<code class=property>visible</code>&rsquo;, it is paginated
2530-
using same rules as visible overflow of blocks in normal flow.
2531-
</ol>
2532-
2533-
<li>If size of flexbox in inline direction is not definite, multi-line
2534-
layout algorithm is run using the set of items that have fit on the
2535-
current page.
2515+
<li> If there are any flexbox items not laid out by the previous step,
2516+
rerun the flexbox sizing algorithm from <a href="#line-sizing">Line
2517+
Length Determination</a> through <a href="#main-alignment">Main-Axis
2518+
Alignment</a> with the next page's size and only the items not already
2519+
laid out. Return to the previous step, but starting from the first line
2520+
not already laid out.
25362521

2537-
<li>Line packing is done on each page, with content on the page
2522+
<li> For each fragment of the flexbox, continue the flexbox layout
2523+
algorithm from <a href="#cross-alignment">Cross Axis Alignment</a> to
2524+
its finish.
25382525
</ol>
25392526
</dl>
25402527

2528+
<p class=issue> I think we need to explicitly handle a definite size in the
2529+
fragmentation axis, and running out of space. (I think it just lays out as
2530+
continuous media within the overflow area.)
2531+
25412532
<h2 id=cssom><span class=secno>11. </span>CSSOM</h2>
25422533

25432534
<div class=issue>

css3-flexbox/Overview.src.html

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,10 +1776,11 @@ <h2 id="pagination">
17761776
and restart flexbox layout entirely.
17771777

17781778
<li>
1779-
If there are any flexbox items not laid out by the previous step,
1779+
If there are any flexbox items not laid out by the first step,
17801780
rerun the flexbox sizing algorithm
17811781
from <a href="#main-sizing">Main Sizing Determination</a>
1782-
through <a href="#cross-sizing">Cross Sizing Determination</a>,
1782+
through <a href="#cross-sizing">Cross Sizing Determination</a>
1783+
using only the items not laid out on a previous line,
17831784
and return to the previous step,
17841785
starting from the first item not already laid out.
17851786
</ol>
@@ -1831,7 +1832,7 @@ <h2 id="pagination">
18311832
lay out as much of its contents as will fit in the space left on the page,
18321833
and fragment the remaining content onto the next page,
18331834
rerunning the flexbox sizing algorithm
1834-
from <a href="#line-sizing">Line Sizing Determination</a>
1835+
from <a href="#line-sizing">Line Length Determination</a>
18351836
through <a href="#main-alignment">Main-Axis Alignment</a>
18361837
into the new page size
18371838
using <em>all</em> the contents (including items completed on previous pages).
@@ -1842,7 +1843,7 @@ <h2 id="pagination">
18421843

18431844
<li>
18441845
For each fragment of the flexbox,
1845-
continue the flexbox layout algorithm
1846+
rerun the flexbox layout algorithm
18461847
from <a href="#cross-alignment">Cross-Axis Alignment</a>
18471848
to its finish.
18481849
For all fragments besides the first,
@@ -1855,42 +1856,63 @@ <h2 id="pagination">
18551856
would fit entirely within a single flexbox fragment,
18561857
it may be shifted into that fragment
18571858
and aligned appropriately.
1858-
</ol>
1859+
</ol>
18591860

18601861
<dt>Multi-line row flexbox
18611862
<dd>
18621863
<ol>
1863-
<li>Collect items into lines and determine line heights:
1864-
1865-
<ol>
1866-
<li>
1867-
<p>If 'flex-line-pack' is 'stretch' and flexbox size in block direction is definite, layout of the complete flexbox has to be done first to determine line heights. Layout is done as usual for non-paginated case, but accounting for forced breaks.
1868-
1869-
<p>If page size varies, this step may have to be redone, again with complete content; special consideration should be to be given to line breaks to ensure that item at the start of current page is also at the start of a line in this hypothetical layout. This specification currently doesn't define how exactly to achieve that.
1870-
1871-
1872-
<li>Otherwise, items are collected into lines and each line is laid out as a single-line flexbox to determine block-direction size of each line.
1873-
</ol>
1874-
1864+
<li>
1865+
Run the flexbox sizing algorithm (without regards to pagination),
1866+
through <a href="#cross-sizing">Cross Sizing Determination</a>.
18751867

1876-
<li>Lines are added one at a time, until out of available space or a forced break is encountered
1868+
<li>
1869+
Lay out as many flexbox lines as possible
1870+
(but at least one),
1871+
starting from the first,
1872+
until there is no more room on the page
1873+
or a forced break is encountered.
18771874

1878-
<li>Breaks inside items (forced or unforced) are not allowed.
1879-
<li>If the first flexbox line on a page doesn't fit in
1880-
cross-axis,
1881-
<ol>
1882-
<li>If the flexbox is not at the top of the page, it is moved to the next page.
1883-
<li>If the flexbox is already at the top of the page, the item may produce overflow. If 'overflow' property of the flexbox is set to 'visible', it is paginated using same rules as visible overflow of blocks in normal flow.
1884-
</ol>
1885-
1875+
<p>
1876+
If a line doesn't fit on the page,
1877+
and the line is not at the top of the page,
1878+
move the line to the next page
1879+
and restart the flexbox layout algorithm entirely,
1880+
using only the items in and following this line.
1881+
1882+
<p>
1883+
If a flexbox item itself causes a forced break,
1884+
rerun the flexbox layout algorithm
1885+
from <a href="#main-sizing">Main Sizing Determination</a>
1886+
through <a href="#main-alignment">Main-Axis Alignment</a>,
1887+
using only the items on this and following lines,
1888+
but with the item causing the break automatically starting a new line
1889+
in the <a href="#algo-line-break"> step,
1890+
then continue with this step.
1891+
Forced breaks <em>within</em> flexbox items are ignored.
18861892

1887-
<li>If size of flexbox in inline direction is not definite, multi-line layout algorithm is run using the set of items
1888-
that have fit on the current page.
1893+
<li>
1894+
If there are any flexbox items not laid out by the previous step,
1895+
rerun the flexbox sizing algorithm
1896+
from <a href="#line-sizing">Line Length Determination</a>
1897+
through <a href="#main-alignment">Main-Axis Alignment</a>
1898+
with the next page's size
1899+
and only the items not already laid out.
1900+
Return to the previous step,
1901+
but starting from the first line not already laid out.
18891902

1890-
<li>Line packing is done on each page, with content on the page
1903+
<li>
1904+
For each fragment of the flexbox,
1905+
continue the flexbox layout algorithm
1906+
from <a href="#cross-alignment">Cross Axis Alignment</a>
1907+
to its finish.
18911908
</ol>
18921909
</dl>
18931910

1911+
<p class='issue'>
1912+
I think we need to explicitly handle a definite size in the fragmentation axis,
1913+
and running out of space.
1914+
(I think it just lays out as continuous media within the overflow area.)
1915+
18941916
<h2 id="cssom">CSSOM</h2>
18951917

18961918
<div class="issue">

0 commit comments

Comments
 (0)