1. If the last row that did partially fit in the fragmentainer was a thead row (and the table was not the first element to be fragmented in the current fragmentainer), break to the next fragmentainer before the table and restart this algorithm in the new fragmentainer.
If that happens and the table was the first element in the current fragmentainer, continue fragmenting the remaining table rows normally in the next fragmentainers and abort these steps (repeated headers and footers are cancelled). Otherwise, continue to the next step.
Why abort? If the next fragmentainer is larger, you may be able to repeat there. We do want to avoid infinite loops of looking for a large enough fragmentainer somewhere down the road, but how about something like this instead:
- If that happens and the table was the first element in the current fragmentainer:
- if all thead rows of this table have already been laid out at least once in a previous fragmentainer, skip all thead rows for this fragmentainer and otherwise apply these steps normally.
- if some thead rows of this table have not yet been laid out in a previous fragmentainers, skip for this fragmentainer those that already have laid out and start with those that have not and otherwise apply these steps normally.
This should ensure that:
- all thead rows are displayed at least once
- if there isn't enough room to fit them all in a single fragmentainer, they get spread in however many fragmentainers it take to get them all
- if somewhere down the line, we start having enough room, we'll start/resume thread row repetition from there.
At least that's what I'm trying to do here.
Looks fine to me. The issue is that at least in Edge if we break the thead in fragments we cannot repeat it later on. However since we only support repeated footer/header when printing and we donât support variations in paper size our behavior is guaranteed to provide the same result as your algorithm.
1. If the last row that did partially fit in the fragmentainer was a tbody or tfoot row restart fragmentation in that fragmentainer with the tfoot being repeated at its bottom and therefore a reduced vertical space. If that doesnât leave enough vertical space in the fragmentainer to contain at least partially one tbody row (or if the last row that did partially fit in the fragmentainer was a tfoot row), return to the previous fragmentation without the repeated tfoot; otherwise keep this new fragmentation. In both cases, continue to the next step.
âwith the tfoot being repeated at its bottomâ shouldn't that be âwith **all** tfoot being repeated at its bottomâ?
I assume the repeat behavior is always all or nothing, you canât get partial repetition. If the rows are included due to normal flow, this isnât a repetition (in short ârepeatedâ does not include the original).
If you can either fit thead or tfoot, you should use the thead. But if you have very large thead that cannot fit but small tfoot that can, why not repeat the tfoot? I think the modified step 2 I gave above gives that result.