Things influencing page breaking
This page tries to list all the elements that influence page breaking. This should help determine the right approach.
The available IPD has influence on line breaking. Each line may be a BP. The available IPD may be different between two pages, ex. the first page in portrait mode the second in landscape. Also, a block with span="all" in a multi-column page has a different available IPD than a block with span="none". Side-floats also have an influence on the available IPD. In this case, it's even more complicated because the line breaking mechanism has to know the available IPD for each an every line.
space-before and space-after add conditional or unconditional lengths in BPD.
keeps and breaks
Keeps and Breaks add conditional or unconditional constraints to the boxes to be layed out.
widows and orphans
These attributes are special keep situations.
Multi-column layout not only has an influence on the available IPD, spans may split up the available content area. Furthermore, spans cause the preceding parts to be balanced in their columns ("sub-pages"). Only then is the starting point in BPD known and therefore the remaining available BPD.
Table headers and footers (and table-omit-header|footer-at-break) have an influence on the allocated BPD. With the border collapsing model there are additional influences on the allocated BPD by the complex interactions between the individual borders. The presence or absence of an adjacent table header or footer also additionally interacts with the decision for an effective cell border. See CollapsingBorderModel.
Footnotes use up BPD and grow upwards from the bottom of the available BPD. Footnotes may start on one page and continue on the next, if there's not enough room on the first page for the whole footnote. Note that a subsequent page may not have the same available IPD.
Before floats use up BPD and grow downwards from the top of the available BPD.
When the the flow runs out of FOs the last page is reached and the current page should be converted to the last page and re-layouted. If the last page provides less BPD than the next-to-last page it may be that the last page actually overflows. (In this case the now next-to-last page should probably be again re-layouted with the previous page-master but with the available BPD of the last-page (to get the headers and footers right.)
references (page-number and page-number-citations)
This is only applicable if there is a plan to replace the reserved space for these FOs by the effective space used.