aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2023-02-23 14:04:16 +0000
committerSimon Steiner <ssteiner@apache.org>2023-02-23 14:04:16 +0000
commitf4205e68b07a965481f326515ba33f08490ebc0a (patch)
tree6138223f2836aba597e2dbee9c688c642b512b97
parent2eb52494850ddcd44150e259829e7ed1cfaacf09 (diff)
downloadxmlgraphics-fop-f4205e68b07a965481f326515ba33f08490ebc0a.tar.gz
xmlgraphics-fop-f4205e68b07a965481f326515ba33f08490ebc0a.zip
FOP-3121: Table width may be too wide when layout width changes
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableRowIterator.java2
-rw-r--r--fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_3.xml67
4 files changed, 70 insertions, 3 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
index ad51ba579..a887215f6 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
@@ -64,7 +64,7 @@ public class TableContentLayoutManager implements PercentBaseContext {
private static final Log LOG = LogFactory.getLog(TableContentLayoutManager.class);
private TableLayoutManager tableLM;
- private TableRowIterator bodyIter;
+ protected TableRowIterator bodyIter;
private TableRowIterator headerIter;
private TableRowIterator footerIter;
private LinkedList headerList;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index bb3ce4fbb..f1750b226 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -318,7 +318,7 @@ public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager
}
private boolean supportResize(FONode node) {
- if (node instanceof AbstractGraphics) {
+ if (node instanceof AbstractGraphics || contentLM.bodyIter.rowIndex == 1) {
return false;
}
FONode.FONodeIterator iterator = node.getChildNodes();
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableRowIterator.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
index 93985425b..19f39e2b4 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
@@ -48,7 +48,7 @@ public class TableRowIterator {
private Iterator rowGroupsIter;
- private int rowIndex;
+ protected int rowIndex;
/**
* Creates a new TableRowIterator.
diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_3.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_3.xml
new file mode 100644
index 000000000..10d30e61e
--- /dev/null
+++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_3.xml
@@ -0,0 +1,67 @@
+<?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 that a table immediately following a changing IPD break is handled properly.
+ </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 master-name="PageFront" page-width="210mm" page-height="297mm" margin-bottom="10mm" margin-top="10mm">
+ <fo:region-body margin-bottom="6mm" region-name="letterPageBody"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master margin-bottom="10mm" margin-top="10mm" master-name="Body Page" page-width="210mm" page-height="297mm">
+ <fo:region-body margin-bottom="6mm" region-name="letterPageBody"/>
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="Last Page" margin-bottom="10mm" margin-top="10mm" page-width="210mm" page-height="297mm">
+ <fo:region-body margin-right="25mm" margin-left="25mm" margin-bottom="6mm" region-name="letterPageBody" background-color="yellow"/>
+ </fo:simple-page-master>
+ <fo:page-sequence-master master-name="LayoutSequence">
+ <fo:repeatable-page-master-alternatives>
+ <fo:conditional-page-master-reference page-position="first" master-reference="PageFront"/>
+ <fo:conditional-page-master-reference page-position="rest" master-reference="Body Page"/>
+ <fo:conditional-page-master-reference page-position="last" master-reference="Last Page"/>
+ </fo:repeatable-page-master-alternatives>
+ </fo:page-sequence-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="LayoutSequence">
+ <fo:flow flow-name="letterPageBody">
+ <fo:block line-height="270mm">test</fo:block>
+ <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 border-top-style="solid">
+ <fo:block>
+ <fo:block>test</fo:block>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:flow>
+ </fo:page-sequence>
+</fo:root>
+ </fo>
+ <checks>
+ <eval expected="434156" xpath="//pageViewport[2]//lineArea/@end-indent"/>
+ </checks>
+</testcase>