]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-3118: Text missing after page break inside table inline trunk
authorSimon Steiner <ssteiner@apache.org>
Tue, 21 Feb 2023 08:49:47 +0000 (08:49 +0000)
committerSimon Steiner <ssteiner@apache.org>
Tue, 21 Feb 2023 08:49:47 +0000 (08:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1907782 13f79535-47bb-0310-9956-ffa450edef68

fop-core/src/main/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
fop/test/layoutengine/standard-testcases/table-inline-pagebreak.xml [new file with mode: 0644]

index e341078de63c3724b7c709ddc831a9bbbc568ab4..5d01c6f75646efd604733582bd7db86ce0dc02ca 100644 (file)
@@ -67,13 +67,13 @@ public final class AreaAdditionUtil {
             }
             if (pos instanceof NonLeafPosition && pos.getPosition() != null) {
                 // pos was created by a child of this FlowLM
-                positionList.add(pos.getPosition());
-                lastLM = (pos.getPosition().getLM());
+                add(pos.getPosition(), positionList);
+                lastLM = pos.getPosition().getLM();
                 if (firstLM == null) {
                     firstLM = lastLM;
                 }
             } else if (pos instanceof SpaceHandlingBreakPosition) {
-                positionList.add(pos);
+                add(pos, positionList);
             } else {
                 // pos was created by this LM, so it must be ignored
             }
@@ -119,8 +119,11 @@ public final class AreaAdditionUtil {
                     parentLM.isFirst(firstPos),
                     parentLM.isLast(lastPos));
         }
-
-
     }
 
+    private static void add(Position pos, LinkedList<Position> positionList) {
+        if (!positionList.isEmpty() || pos.getLM() != null) {
+            positionList.add(pos);
+        }
+    }
 }
diff --git a/fop/test/layoutengine/standard-testcases/table-inline-pagebreak.xml b/fop/test/layoutengine/standard-testcases/table-inline-pagebreak.xml
new file mode 100644 (file)
index 0000000..3b8cc52
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks table inline page break
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
+      <fo:layout-master-set>
+        <fo:simple-page-master margin-right="1in" margin-left="1in" margin-bottom="1in" margin-top="1in" page-width="8.5in" page-height="11in" master-name="Page">
+          <fo:region-body margin-right="0in" margin-left="0in" margin-bottom="0.50in" margin-top="0in" region-name="Body"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence format="1" id="TH_LastPage" master-reference="Page">
+        <fo:flow flow-name="Body">
+          <fo:table table-layout="fixed" width="100%">
+            <fo:table-column column-width="proportional-column-width(100)" column-number="1"/>
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell>
+                  <fo:block>
+                    <fo:inline>
+                      <fo:leader/>
+                      <fo:block break-before="page"/>This is an example of a Table</fo:inline>
+                  </fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <eval expected="This" xpath="//pageViewport[2]//word[1]"/>
+    <eval expected="Table" xpath="//pageViewport[2]//word[7]"/>
+  </checks>
+</testcase>