From: Simon Steiner Date: Fri, 21 Jun 2024 10:01:46 +0000 (+0100) Subject: FOP-3186: Only support 1 column for redo of layout without page pos only X-Git-Tag: 2_10~24 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=12e2889f4e86bd99cb2bc5e5a183e275e22c91de;p=xmlgraphics-fop.git FOP-3186: Only support 1 column for redo of layout without page pos only --- diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java index f6bf00253..40b518af3 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java @@ -26,6 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.fo.Constants; +import org.apache.fop.fo.pagination.RegionBody; import org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode; import org.apache.fop.traits.MinOptMax; import org.apache.fop.util.ListUtil; @@ -415,8 +416,7 @@ public abstract class AbstractBreaker { onLastPageAndIPDChanges = (lastPageHasIPDChange(optimalPageCount) && !thereIsANonRestartableLM(alg) && (shouldRedoLayout() || (wasLayoutRedone() && optimalPageCount > 1))); } - if ((ipdChangesOnNextPage || hasMoreContent() || optimalPageCount > 1) - && pslm != null && pslm.getCurrentPage().isPagePositionOnly) { + if (shouldRedoLayoutWithoutPagePositionOnly(ipdChangesOnNextPage, optimalPageCount)) { return false; } if (alg.handlingFloat()) { @@ -465,6 +465,15 @@ public abstract class AbstractBreaker { return true; } + private boolean shouldRedoLayoutWithoutPagePositionOnly(boolean ipdChangesOnNextPage, int optimalPageCount) { + if ((ipdChangesOnNextPage || hasMoreContent() || optimalPageCount > 1) + && pslm != null && pslm.getCurrentPage().isPagePositionOnly) { + RegionBody rb = (RegionBody)pslm.getCurrentPage().getSimplePageMaster().getRegion(Constants.FO_REGION_BODY); + return rb.getColumnCount() == 1; + } + return false; + } + /** * Returns {@code true} if the given position or one of its descendants * corresponds to a non-restartable LM. diff --git a/fop/test/layoutengine/standard-testcases/page-position_only_5.xml b/fop/test/layoutengine/standard-testcases/page-position_only_5.xml new file mode 100644 index 000000000..631948534 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/page-position_only_5.xml @@ -0,0 +1,86 @@ + + + + + +

+ This test checks for the use of an 'only' conditional-page-master-reference (XSL 1.1) +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Footer 1 + + + Footer 2 + + + Footer 3 + + + Footer 4 + + + Footer 5 + + + Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 + bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw bgbg gresgfe rwfwr rfrw fwrfrw + end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end + + + + + + + + +