Vincent Hennebert wrote:

I have some questions regarding the handling of Position elements. I'm
not familiar with that part of the code yet, and as there is little or
no javadoc for those it's a bit difficult to guess their purposes just
by looking at the code.
What's the purpose of a LeafPosition? Of a NonLeafPosition? What's the
purpose of the wrapPositionElements method in
BlockStackingLayoutManager?

In the page breaking scenario, LeafPositions are LineBreakPositions, created by the LineLM and storing the break information.

Each LM from the BlockLM parent up to the FlowLM add their own elements and wrap the Positions. During the addAreas() phase, the Positions (not the elements) are used, and it's important that each LM (from the FlowLM down to the LineLM) create the necessary areas (reference areas, block areas, line areas...) in the right order: the wrapping process allows each LM to receive the Positions, do its job, unwrap the Positions and then call the lower-level LMs.

Subsidiary question: why would one sometimes
force the wrapping, sometimes not?

I'm afraid this is because of some inconsistencies in the handling of the positions (and, in turns, this creates other inconsistencies ;-)).

In this moment I don't remember the details, but I think there are some differences from LM to LM concerning the handling of elements representing breaks and / or spaces, so that some LMs assume all "relevant" Positions are NonLeafPositions and discard the other ones while other behave in a different way ...

So, there's definitely some room for refactoring / cleaning :-)

HTH

Regards
    Luca

Reply via email to