]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Code clean-up and simplification
authorVincent Hennebert <vhennebert@apache.org>
Thu, 14 Nov 2013 09:45:39 +0000 (09:45 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Thu, 14 Nov 2013 09:45:39 +0000 (09:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1541863 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/flow/InlineContainer.java
src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java

index 13ea9943ac0de9d099183739e7424643d86d580c..bcff3dc721aa14009690fedc1d0502b429440112 100644 (file)
@@ -158,10 +158,18 @@ public class InlineContainer extends FObj {
         return this.displayAlign;
     }
 
+    public KeepProperty getKeepWithPrevious() {
+        return keepWithPrevious;
+    }
+
     public KeepProperty getKeepTogether() {
         return keepTogether;
     }
 
+    public KeepProperty getKeepWithNext() {
+        return keepWithNext;
+    }
+
     public SpaceProperty getLineHeight() {
         return lineHeight;
     }
index 5127794c036dfbcd6e39bbb411630d6d1b8725a6..771bda255717a9f4ecb0e14ba346d3c9498ee893 100644 (file)
@@ -19,6 +19,7 @@
 
 package org.apache.fop.layoutmgr.inline;
 
+import java.awt.geom.Rectangle2D;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
@@ -86,11 +87,9 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen
     @Override
     public List<KnuthSequence> getNextKnuthElements(LayoutContext context, int alignment) {
         determineIPD(context);
-        LayoutContext childLC = LayoutContext.offspringOf(context); // TODO copyOf?
-        childLC.setRefIPD(contentAreaIPD);
-        childElements = getChildKnuthElements(childLC, alignment); // TODO which alignment?
+        childElements = getChildKnuthElements(context, alignment);
         determineBPD();
-        alignmentContext = makeAlignmentContext(context); // TODO correct?
+        alignmentContext = makeAlignmentContext(context);
         Position position = new Position(this, 0);
         KnuthSequence knuthSequence = new InlineKnuthSequence();
         knuthSequence.add(new KnuthInlineBox(contentAreaIPD, alignmentContext, position, false));
@@ -117,18 +116,16 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen
         List<ListElement> allChildElements = new LinkedList<ListElement>();
         LayoutManager childLM;
         while ((childLM = getChildLM()) != null) {
-            LayoutContext childLC = LayoutContext.offspringOf(layoutContext); // TODO copyOf? newInstance?
-            childLC.setRefIPD(layoutContext.getRefIPD());
+            LayoutContext childLC = LayoutContext.offspringOf(layoutContext);
+            childLC.setRefIPD(contentAreaIPD);
             @SuppressWarnings("unchecked")
             List<ListElement> childElements = childLM.getNextKnuthElements(childLC, alignment);
             allChildElements.addAll(childElements);
-            // TODO breaks, keeps, empty content
         }
         handleIPDOverflow();
         wrapPositions(allChildElements);
         SpaceResolver.resolveElementList(allChildElements);
         SpaceResolver.performConditionalsNotification(allChildElements, 0, allChildElements.size() - 1, -1);
-        // TODO break-before, break-after
         return allChildElements;
     }
 
@@ -254,9 +251,6 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen
         assert inlineContainerPosition != null;
         KnuthPossPosIter childPosIter = new KnuthPossPosIter(childElements);
         AreaAdditionUtil.addAreas(this, childPosIter, context);
-
-//        boolean isLast = (context.isLastArea() && prevLM == lastChildLM);
-//        context.setFlags(LayoutContext.LAST_AREA, isLast);
     }
 
     @Override
@@ -267,23 +261,15 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen
             TraitSetter.setProducerID(referenceArea, fobj.getId());
             referenceArea.setIPD(contentAreaIPD);
             currentViewport = new InlineViewport(referenceArea);
-            currentViewport.setBlockProgressionOffset(alignmentContext.getOffset());
             currentViewport.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
+            TraitSetter.setProducerID(currentViewport, fobj.getId());
+            currentViewport.setBlockProgressionOffset(alignmentContext.getOffset());
             currentViewport.setIPD(getContentAreaIPD());
             currentViewport.setBPD(getContentAreaBPD());
-            TraitSetter.setProducerID(currentViewport, fobj.getId());
-            TraitSetter.addBorders(currentViewport,
-                    borderProps,
-                    false, false, false, false, this);
-            TraitSetter.addPadding(currentViewport,
-                    borderProps,
-                    false, false, false, false, this);
-            TraitSetter.addBackground(currentViewport,
-                    borderProps,
-                    this);
+            TraitSetter.addBackground(currentViewport, borderProps, this);
             currentViewport.setClip(needClip());
             currentViewport.setContentPosition(
-                    new java.awt.geom.Rectangle2D.Float(0, 0, getContentAreaIPD(), getContentAreaBPD()));
+                    new Rectangle2D.Float(0, 0, getContentAreaIPD(), getContentAreaBPD()));
             getParent().addChildArea(currentViewport);
         }
         return referenceArea;