diff options
author | Jeremias Maerki <jeremias@apache.org> | 2008-03-10 10:06:37 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2008-03-10 10:06:37 +0000 |
commit | 8bf1daae93a7cf5459835211fa3b5f6429b6b644 (patch) | |
tree | 856f564ce521befda90376eab3da5003621c0767 /src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java | |
parent | a50c4b9642d47a11f3fc288c2d714feeec69fd61 (diff) | |
download | xmlgraphics-fop-8bf1daae93a7cf5459835211fa3b5f6429b6b644.tar.gz xmlgraphics-fop-8bf1daae93a7cf5459835211fa3b5f6429b6b644.zip |
Fixed NPE in BlockContainerLayoutManager when used as a child of an inline-level FO. Split IP and BP stack limits in LayoutContext (there's now a certain amount of redundancy with "refIPD" in LayoutContext which I didn't resolve).
Areas are now generated for block-level FOs when used as children of inline-level FOs.
ClassCastException in ListLayoutManager.mustKeepTogether() fixed (occured if used as child of an inline-level FO).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@635508 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index fc60b561e..435f25b48 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -38,7 +38,6 @@ import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.flow.BlockContainer; import org.apache.fop.fo.properties.CommonAbsolutePosition; -import org.apache.fop.layoutmgr.inline.InlineLayoutManager; import org.apache.fop.traits.MinOptMax; import org.apache.fop.traits.SpaceVal; @@ -201,7 +200,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager = (getBlockContainerFO().getReferenceOrientation() % 180 != 0); autoHeight = false; //boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0); - int maxbpd = context.getStackLimit().opt; + int maxbpd = context.getStackLimitBP().opt; int allocBPD; if (height.getEnum() == EN_AUTO || (!height.isAbsolute() && getAncestorBlockAreaBPD() <= 0)) { @@ -280,8 +279,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager LayoutContext childLC = new LayoutContext(0); childLC.copyPendingMarksFrom(context); // curLM is a ? - childLC.setStackLimit(MinOptMax.subtract(context - .getStackLimit(), stackLimit)); + childLC.setStackLimitBP(MinOptMax.subtract(context.getStackLimitBP(), stackLimit)); childLC.setRefIPD(relDims.ipd); childLC.setWritingMode(getBlockContainerFO().getWritingMode()); @@ -411,7 +409,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager if (isFixed()) { availHeight = (int)getCurrentPV().getViewArea().getHeight(); } else { - availHeight = context.getStackLimit().opt; + availHeight = context.getStackLimitBP().opt; } allocBPD = availHeight; allocBPD -= offset.y; @@ -444,7 +442,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager } } } else { - int maxbpd = context.getStackLimit().opt; + int maxbpd = context.getStackLimitBP().opt; allocBPD = maxbpd; if (!switchedProgressionDirection) { autoHeight = true; @@ -625,7 +623,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager while ((curLM = getChildLM()) != null) { LayoutContext childLC = new LayoutContext(0); - childLC.setStackLimit(context.getStackLimit()); + childLC.setStackLimitBP(context.getStackLimitBP()); childLC.setRefIPD(context.getRefIPD()); childLC.setWritingMode(getBlockContainerFO().getWritingMode()); @@ -854,7 +852,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager // set last area flag lc.setFlags(LayoutContext.LAST_AREA, (layoutContext.isLastArea() && childLM == lastLM)); - /*LF*/lc.setStackLimit(layoutContext.getStackLimit()); + /*LF*/lc.setStackLimitBP(layoutContext.getStackLimitBP()); // Add the line areas to Area childLM.addAreas(childPosIter, lc); } @@ -992,30 +990,21 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public boolean mustKeepTogether() { //TODO Keeps will have to be more sophisticated sooner or later - return (!getBlockContainerFO().getKeepTogether().getWithinPage().isAuto() - || !getBlockContainerFO().getKeepTogether().getWithinColumn().isAuto() - || (getParent() instanceof BlockLevelLayoutManager - && ((BlockLevelLayoutManager) getParent()).mustKeepTogether()) - || (getParent() instanceof InlineLayoutManager - && ((InlineLayoutManager) getParent()).mustKeepTogether())); + return super.mustKeepTogether() + || !getBlockContainerFO().getKeepTogether().getWithinPage().isAuto() + || !getBlockContainerFO().getKeepTogether().getWithinColumn().isAuto(); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public boolean mustKeepWithPrevious() { return !getBlockContainerFO().getKeepWithPrevious().getWithinPage().isAuto() || !getBlockContainerFO().getKeepWithPrevious().getWithinColumn().isAuto(); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public boolean mustKeepWithNext() { return !getBlockContainerFO().getKeepWithNext().getWithinPage().isAuto() || !getBlockContainerFO().getKeepWithNext().getWithinColumn().isAuto(); |