From ffce682a4f1b507a431eb655b05d57b9e7f6c5a4 Mon Sep 17 00:00:00 2001 From: Matthias Reischenbacher Date: Mon, 15 Jun 2015 14:12:01 +0000 Subject: [PATCH] FOP-2487: replace cached pages if span condition doesn't match git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1685586 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/layoutmgr/PageProvider.java | 12 ++++- .../region-body_column-count_span_5.xml | 48 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 test/layoutengine/standard-testcases/region-body_column-count_span_5.xml diff --git a/src/java/org/apache/fop/layoutmgr/PageProvider.java b/src/java/org/apache/fop/layoutmgr/PageProvider.java index ba35ecb11..bdb313003 100644 --- a/src/java/org/apache/fop/layoutmgr/PageProvider.java +++ b/src/java/org/apache/fop/layoutmgr/PageProvider.java @@ -23,11 +23,12 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import org.apache.fop.area.AreaTreeHandler; import org.apache.fop.area.PageViewport; import org.apache.fop.fo.Constants; import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.fo.pagination.Region; +import org.apache.fop.fo.pagination.RegionBody; import org.apache.fop.fo.pagination.SimplePageMaster; /** @@ -304,6 +305,15 @@ public class PageProvider implements Constants { log.debug("blank condition doesn't match. Replacing PageViewport."); replace = true; } + if (page.getPageViewport().getCurrentSpan().getColumnCount() == 1 + && !this.spanAllForCurrentElementList) { + RegionBody rb = (RegionBody)page.getSimplePageMaster().getRegion(Region.FO_REGION_BODY); + int colCount = rb.getColumnCount(); + if (colCount > 1) { + log.debug("Span doesn't match. Replacing PageViewport."); + replace = true; + } + } if ((isLastPage && indexOfCachedLastPage != intIndex) || (!isLastPage && indexOfCachedLastPage >= 0)) { log.debug("last page condition doesn't match. Replacing PageViewport."); diff --git a/test/layoutengine/standard-testcases/region-body_column-count_span_5.xml b/test/layoutengine/standard-testcases/region-body_column-count_span_5.xml new file mode 100644 index 000000000..55f7989c1 --- /dev/null +++ b/test/layoutengine/standard-testcases/region-body_column-count_span_5.xml @@ -0,0 +1,48 @@ + + + + + +

+ This test checks multi-column documents. Check that spanned section that overflow + the current page, don't span to the next page. +

+
+ + + + + + + + + + + overflow-block + + col1 + col2 + + + + + + + +
-- 2.39.5