]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-2487: replace cached pages if span condition doesn't match
authorMatthias Reischenbacher <matthias@apache.org>
Mon, 15 Jun 2015 14:12:01 +0000 (14:12 +0000)
committerMatthias Reischenbacher <matthias@apache.org>
Mon, 15 Jun 2015 14:12:01 +0000 (14:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1685586 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/PageProvider.java
test/layoutengine/standard-testcases/region-body_column-count_span_5.xml [new file with mode: 0644]

index ba35ecb113645c8ebf1afe3aedbe6deda242e056..bdb3130031f1293d4c9646e003120636754b4802 100644 (file)
@@ -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 (file)
index 0000000..55f7989
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+  Licensed to the Apache Software Foundation (ASF) under one or more\r
+  contributor license agreements.  See the NOTICE file distributed with\r
+  this work for additional information regarding copyright ownership.\r
+  The ASF licenses this file to You under the Apache License, Version 2.0\r
+  (the "License"); you may not use this file except in compliance with\r
+  the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+-->\r
+<!-- $Id: region-body_column-count_span_4.xml 993357 2010-09-07 13:45:39Z jeremias $ -->\r
+<testcase>\r
+  <info>\r
+    <p>\r
+      This test checks multi-column documents. Check that spanned section that overflow\r
+      the current page, don't span to the next page.\r
+    </p>\r
+  </info>\r
+  <fo>\r
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">\r
+      <fo:layout-master-set>\r
+          <fo:simple-page-master master-name="odd" page-height="200mm" page-width="150mm">\r
+              <fo:region-body column-count="2"/>\r
+          </fo:simple-page-master>\r
+      </fo:layout-master-set>\r
+      <fo:page-sequence master-reference="odd">\r
+          <fo:flow flow-name="xsl-region-body">\r
+        <fo:block-container id="overflow-block-ct" keep-together.within-page="always"\r
+            height="200.1mm" span="all">\r
+          <fo:block id="overflow-block">overflow-block</fo:block>\r
+        </fo:block-container>\r
+        <fo:block id="col1">col1</fo:block>\r
+        <fo:block id="col2" break-before="column">col2</fo:block>\r
+          </fo:flow>\r
+      </fo:page-sequence>\r
+  </fo:root>\r
+  </fo>\r
+  <checks>\r
+    <eval expected="2" xpath="count(//pageViewport)"/>\r
+  </checks>\r
+</testcase>\r