From fc24ca179b914ba84486f18c337e344b0abb43a1 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Wed, 1 Sep 2021 06:11:31 +0000 Subject: [PATCH] FOP-3025: Keep table size on changing ipd which has graphics git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1892775 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutmgr/table/TableLayoutManager.java | 19 ++- .../flow_changing-ipd_table_2.xml | 143 ++++++++++++++++++ 2 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_2.xml 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 b4b49b705..f3407b749 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 @@ -34,6 +34,7 @@ import org.apache.fop.datatypes.LengthBase; import org.apache.fop.fo.Constants; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.flow.AbstractGraphics; import org.apache.fop.fo.flow.Marker; import org.apache.fop.fo.flow.Markers; import org.apache.fop.fo.flow.RetrieveTableMarker; @@ -243,7 +244,9 @@ public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager */ if (tableUnit == 0.0) { tableUnit = columns.computeTableUnit(this); - tableUnit = Math.max(tableUnit, oldTableUnit); + if (oldTableUnit > tableUnit && supportResize(fobj)) { + tableUnit = oldTableUnit; + } } if (!firstVisibleMarkServed) { @@ -314,6 +317,20 @@ public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager return returnList; } + private boolean supportResize(FONode node) { + if (node instanceof AbstractGraphics) { + return false; + } + FONode.FONodeIterator iterator = node.getChildNodes(); + while (iterator != null && iterator.hasNext()) { + FONode x = (FONode) iterator.next(); + if (!supportResize(x)) { + return false; + } + } + return true; + } + /** {@inheritDoc} */ public Position getAuxiliaryPosition() { /* diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_2.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_2.xml new file mode 100644 index 000000000..a1e9610fe --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_table_2.xml @@ -0,0 +1,143 @@ + + + + + +

+ This test checks that a table immediately following a changing IPD break is handled properly. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + £73,477.30 + + + + + + + + + + + + + £10,123.56 + + + + + + + + + + + + + + + +
-- 2.39.5