Jeremias Maerki wrote:
> Until now, the LMs kept track of the previous LM and created an infinite
> penalty if a keep-with-next situation presented itself. This ignores the
> fact, however, that lower-level FOs can have a keep-with-next that
> influences a following FO on a higher level (see keep-with-next1a). I
> solved it by introducing a flag (KEEP_WITH_NEXT_PENDING) on the
> LayoutContext which will be propagated up the LM hierarchy. The next LM
> in charge of adding a penalty will check for that flag on the
> LayoutContext. That even made keep-with-next on tables very easy. It
> already works locally.
If it works, I think it's good! :-)
I have thought of an alternative approach (but I did not try and implement
it, so it's just an abstact idea that could be completely wrong): the
methods mustKeepWithPrevious() and mustKeepWithNext(), that at the moment
only check the properties of their node, could call the same method on the
relevant child.
So, for example, BlockLM.mustKeepWithPrevious() could be:
return !getBlockFO().getKeepWithPrevious().getWithinPage().isAuto()
|| !getBlockFO().getKeepWithPrevious().getWithinColumn().isAuto())
|| firstChild.mustKeepWithPrevious();
and BlockLM.mustKeepWithNext()
return !getBlockFO().getKeepWithNext().getWithinPage().isAuto()
|| !getBlockFO().getKeepWithNext().getWithinColumn().isAuto()
|| lastChild.mustKeeptWithNext();
Regards
Luca