diff options
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index 3688bcff0..a51d64c2c 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java @@ -154,16 +154,18 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen public void addAreas(PositionIterator posIter, LayoutContext context) { Position inlineContainerPosition = null; while (posIter.hasNext()) { - Position pos = posIter.next(); - if (pos.getLM() == this) { - inlineContainerPosition = pos; - } - } - if (inlineContainerPosition != null) { - SpaceResolver.performConditionalsNotification(childElements, 0, childElements.size() - 1, -1); - KnuthPossPosIter childPosIter = new KnuthPossPosIter(childElements); - AreaAdditionUtil.addAreas(this, childPosIter, context); + /* + * Should iterate only once, but hasNext must be called twice for its + * side-effects to apply and the iterator to switch to the next LM. + */ + assert inlineContainerPosition == null; + inlineContainerPosition = posIter.next(); + assert inlineContainerPosition.getLM() == this; } + assert inlineContainerPosition != null; + SpaceResolver.performConditionalsNotification(childElements, 0, childElements.size() - 1, -1); + KnuthPossPosIter childPosIter = new KnuthPossPosIter(childElements); + AreaAdditionUtil.addAreas(this, childPosIter, context); // boolean isLast = (context.isLastArea() && prevLM == lastChildLM); // context.setFlags(LayoutContext.LAST_AREA, isLast); |