From: Vincent Hennebert Date: Thu, 14 Nov 2013 09:45:39 +0000 (+0000) Subject: Code clean-up and simplification X-Git-Tag: fop-2_0~137^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7a151fd401340c0c4578a4d865a3245551ff85c4;p=xmlgraphics-fop.git Code clean-up and simplification git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1541863 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java index 13ea9943a..bcff3dc72 100644 --- a/src/java/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java @@ -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; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index 5127794c0..771bda255 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java @@ -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 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 allChildElements = new LinkedList(); 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 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;