You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2013/10/28 18:13:14 UTC

svn commit: r1536424 - /xmlgraphics/fop/branches/Temp_InlineContainer/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java

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: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org