diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2008-11-19 22:45:06 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2008-11-19 22:45:06 +0000 |
commit | f15eca494468c55454bbc20dee20bb874f39c5ab (patch) | |
tree | 180138ad73821db22b684c499a836eb4c2f72a68 /src/java/org/apache/fop/layoutmgr | |
parent | 45c1746b5f718f40e9a9dd013a6e9249eb144fe8 (diff) | |
download | xmlgraphics-fop-f15eca494468c55454bbc20dee20bb874f39c5ab.tar.gz xmlgraphics-fop-f15eca494468c55454bbc20dee20bb874f39c5ab.zip |
Bugzilla 46240:
Fixed a bug in combining break-before with a span change.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@719110 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java | 9 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/LayoutContext.java | 26 |
2 files changed, 25 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java index 293d6dbe0..42f08a42d 100644 --- a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java @@ -50,8 +50,6 @@ public class FlowLayoutManager extends BlockStackingLayoutManager /** Array of areas currently being filled stored by area class */ private BlockParent[] currentAreas = new BlockParent[Area.CLASS_MAX]; - private int currentSpan = EN_NONE; - /** * This is the top level layout manager. * It is created by the PageSequence FO. @@ -89,10 +87,11 @@ public class FlowLayoutManager extends BlockStackingLayoutManager } else if (curLM instanceof BlockContainerLayoutManager) { span = ((BlockContainerLayoutManager)curLM).getBlockContainerFO().getSpan(); } + + int currentSpan = context.getCurrentSpan(); if (currentSpan != span) { log.debug("span change from " + currentSpan + " to " + span); context.signalSpanChange(span); - currentSpan = span; SpaceResolver.resolveElementList(returnList); return returnList; } @@ -228,7 +227,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager oldElement = (KnuthElement)oldListIterator.next(); if (oldElement.getPosition() instanceof NonLeafPosition) { // oldElement was created by a descendant of this FlowLM - oldElement.setPosition(((NonLeafPosition)oldElement.getPosition()).getPosition()); + oldElement.setPosition((oldElement.getPosition()).getPosition()); } else { // thisElement was created by this FlowLM, remove it oldListIterator.remove(); @@ -344,7 +343,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager * @return the BPD of the content area */ public int getContentAreaBPD() { - return (int) getCurrentPV().getBodyRegion().getBPD(); + return getCurrentPV().getBodyRegion().getBPD(); } } diff --git a/src/java/org/apache/fop/layoutmgr/LayoutContext.java b/src/java/org/apache/fop/layoutmgr/LayoutContext.java index 8b716dfde..3526ed239 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutContext.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutContext.java @@ -88,7 +88,8 @@ public class LayoutContext { */ private MinOptMax stackLimitIP; - /** True if current element list is spanning in multi-column layout. */ + /** to keep track of spanning in multi-column layout */ + private int currentSpan = Constants.NOT_SET; private int nextSpan = Constants.NOT_SET; /** inline-progression-dimension of nearest ancestor reference area */ @@ -522,22 +523,37 @@ public class LayoutContext { } /** - * @return true if the current element list ends early because of a span change - * in multi-column layout. + * @return one of: {@link Constants#NOT_SET}, {@link Constants#EN_NONE} + * {@link Constants#EN_ALL} */ public int getNextSpan() { return nextSpan; } /** + * @return one of: {@link Constants#NOT_SET}, {@link Constants#EN_NONE} + * {@link Constants#EN_ALL} + */ + public int getCurrentSpan() { + return (currentSpan == Constants.NOT_SET) + ? Constants.EN_NONE : currentSpan; + } + + /** * Used to signal the PSLM that the element list ends early because of a span change in * multi-column layout. * @param span the new span value (legal values: NOT_SET, EN_NONE, EN_ALL) */ public void signalSpanChange(int span) { - if (span == Constants.NOT_SET || span == Constants.EN_NONE || span == Constants.EN_ALL) { + switch (span) { + case Constants.NOT_SET: + case Constants.EN_NONE: + case Constants.EN_ALL: + this.currentSpan = this.nextSpan; this.nextSpan = span; - } else { + break; + default: + assert false; throw new IllegalArgumentException("Illegal value on signalSpanChange() for span: " + span); } |