/**
* Creates the child areas for the given layout manager.
- * @param bslm the BlockStackingLayoutManager instance for which "addAreas" is performed.
+ * @param parentLM the parent layout manager
* @param parentIter the position iterator
* @param layoutContext the layout context
*/
- public static void addAreas(BlockStackingLayoutManager bslm,
+ public static void addAreas(AbstractLayoutManager parentLM,
PositionIterator parentIter, LayoutContext layoutContext) {
LayoutManager childLM;
LayoutContext lc = LayoutContext.offspringOf(layoutContext);
Position firstPos = null;
Position lastPos = null;
- if (bslm != null) {
- bslm.addId();
+ if (parentLM != null) {
+ parentLM.addId();
}
// "unwrap" the NonLeafPositions stored in parentIter
//doesn't give us that info.
}
- if (bslm != null) {
- bslm.registerMarkers(
+ if (parentLM != null) {
+ parentLM.registerMarkers(
true,
- bslm.isFirst(firstPos),
- bslm.isLast(lastPos));
+ parentLM.isFirst(firstPos),
+ parentLM.isLast(lastPos));
}
PositionIterator childPosIter = new PositionIterator(positionList.listIterator());
childLM.addAreas(childPosIter, lc);
}
- if (bslm != null) {
- bslm.registerMarkers(
+ if (parentLM != null) {
+ parentLM.registerMarkers(
false,
- bslm.isFirst(firstPos),
- bslm.isLast(lastPos));
+ parentLM.isFirst(firstPos),
+ parentLM.isLast(lastPos));
}
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.layoutmgr.AbstractLayoutManager;
+import org.apache.fop.layoutmgr.AreaAdditionUtil;
import org.apache.fop.layoutmgr.BlockLevelEventProducer;
import org.apache.fop.layoutmgr.ElementListUtils;
import org.apache.fop.layoutmgr.InlineKnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.ListElement;
+import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.SpaceResolver;
allChildElements.addAll(childElements);
// TODO breaks, keeps, empty content
}
+ wrapPositions(allChildElements);
SpaceResolver.resolveElementList(allChildElements);
// TODO break-before, break-after
return allChildElements;
}
+ private void wrapPositions(List<ListElement> elements) {
+ for (ListElement element : elements) {
+ Position position = new NonLeafPosition(this, element.getPosition());
+ notifyPos(position);
+ element.setPosition(position);
+ }
+ }
+
@Override
public void addAreas(PositionIterator posIter, LayoutContext context) {
Position inlineContainerPosition = null;
inlineContainerPosition = pos;
}
}
- addId();
-// addMarkersToPage(
-// true,
-// true,
-// lastPos == null || isLast(lastPos));
-
if (inlineContainerPosition != null) {
- LayoutManager childLM;
+ SpaceResolver.performConditionalsNotification(childElements, 0, childElements.size() - 1, -1);
KnuthPossPosIter childPosIter = new KnuthPossPosIter(childElements);
- while ((childLM = childPosIter.getNextChildLM()) != null) {
- LayoutContext childLC = LayoutContext.copyOf(context); // TODO correct?
- childLM.addAreas(childPosIter, childLC);
- }
+ AreaAdditionUtil.addAreas(this, childPosIter, context);
}
-// addMarkersToPage(
-// false,
-// true,
-// lastPos == null || isLast(lastPos));
-
// boolean isLast = (context.isLastArea() && prevLM == lastChildLM);
// context.setFlags(LayoutContext.LAST_AREA, isLast);
}
</fo:inline-container> After.</fo:block>
</fo:flow>
</fo:page-sequence>
+ <fo:page-sequence master-reference="page">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>Before: <fo:inline-container width="80pt">
+ <fo:block space-after="10pt">Block 1</fo:block>
+ <fo:block space-before="20pt" space-after="10pt"
+ space-after.conditionality="retain">Block 2</fo:block>
+ </fo:inline-container> After.</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
</fo:root>
</fo>
<checks>
<eval expected="40000" xpath="//pageSequence[1]//viewport/@bpd"/>
+
<eval expected="35000" xpath="//pageSequence[2]//viewport/@bpd"/>
<true xpath="//pageSequence[2]//viewport/@clip"/>
+
+ <eval expected="50000" xpath="//pageSequence[3]//viewport/@bpd"/>
</checks>
</testcase>