If an expression reference another expression in a parent fo, the parent fo expression must be evaluated against the LayoutContext that was in effect for the parent fo and *not* against the child fo LayoutContext.
<fo:block id="a" border-start-width="10%"> <fo:block id="b" border-start-width="inherit">
It must be the LayoutContex for 'a' that is used when we evaluate the 10% even when we call:
with the layout context for 'b'.
[leader example snipped}
The 30% must be calculated w.r.t. the page width for both leaders, and both leaders must be equally wide. This is not the current result.
When I tried to remedy this, I got confused by the sets of symbols on PercentBase and on LengthBase. Why are there 2 sets of symbols?
The idea was that PercentBase.XXX names the stored values and LengthBase names the algorithm for looking up a base value. Most of the time these maps one-to-one to each other but for some I imaged that they would be different. margin-top f.ex. should really use an algorithm like BLOCKIPD_OR_PAGEHEIGHT which would look for either PercentBase.BLOCK_IPD or PercentBase.PAGE_HEIGHT depending on the fo:element.
Clearly all of this isn't complete implemented in my patch yet and perhaps it can be done in a simpler way. Better names for PercentBase and LengthBase could help.
They are mapped onto each other in LengthBase.getBaseLength(), but not all symbols are mapped, e.g. LengthBase.CONTAINING_BOX, which is used by leader-length, has no corresponding action. Some further integration of old and new code must be done here.
Question: What to do if I insert a fo:wrapper between fo:flow and fo:block? That makes it the parent of fo:block, but it has no layout manager corresponding to it. Override getLayoutDimension on it?
I don't think so, but perhaps I don't just yet understand the situation that you are describing. A percentage on the wrapper should be resolved against the parent of the wrapper, right?