Author: vhennebert
Date: Mon Oct 28 17:13:14 2013
New Revision: 1536424

URL: http://svn.apache.org/r1536424
Log:
Slightly simplified looping through positions in addAreas

Modified:
    
xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java

Modified: 
xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java?rev=1536424&r1=1536423&r2=1536424&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
 Mon Oct 28 17:13:14 2013
@@ -154,16 +154,18 @@ public class InlineContainerLayoutManage
     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);



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to