aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2013-10-28 17:13:14 +0000
committerVincent Hennebert <vhennebert@apache.org>2013-10-28 17:13:14 +0000
commit8c5aef924ae27549bac3d34057e5e36aaf0bca81 (patch)
treee48d8ff4e9a2e6c56bce5ba4f44c706559a190e5 /src/java/org
parentdc25857bb531326a321c930b7734626aaef3b909 (diff)
downloadxmlgraphics-fop-8c5aef924ae27549bac3d34057e5e36aaf0bca81.tar.gz
xmlgraphics-fop-8c5aef924ae27549bac3d34057e5e36aaf0bca81.zip
Slightly simplified looping through positions in addAreas
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1536424 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java20
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);