From 7951774f1754564fb27f775ce3eccbdf71e3e062 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Thu, 11 Oct 2018 15:28:23 +0000 Subject: [PATCH] FOP-2822: Use correct ipd for table inside float git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1843563 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutmgr/FloatContentLayoutManager.java | 23 ++++++- .../standard-testcases/float_8.xml | 67 +++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 fop/test/layoutengine/standard-testcases/float_8.xml diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java index dd65be248..b489760ce 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java @@ -31,6 +31,7 @@ import org.apache.fop.fo.flow.Float; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.layoutmgr.inline.FloatLayoutManager; import org.apache.fop.layoutmgr.inline.KnuthInlineBox; +import org.apache.fop.layoutmgr.table.TableLayoutManager; public class FloatContentLayoutManager extends SpacedBorderedPaddedBlockLayoutManager { @@ -75,7 +76,7 @@ public class FloatContentLayoutManager extends SpacedBorderedPaddedBlockLayoutMa public void addChildArea(Area childArea) { floatContentArea.addChildArea(childArea); floatContentArea.setBPD(childArea.getAllocBPD()); - int effectiveContentIPD = childArea.getEffectiveAllocIPD(); + int effectiveContentIPD = getContentAreaIPD(childLMs, childArea); int contentIPD = childArea.getIPD(); int xOffset = childArea.getBorderAndPaddingWidthStart(); floatContentArea.setIPD(effectiveContentIPD); @@ -99,6 +100,26 @@ public class FloatContentLayoutManager extends SpacedBorderedPaddedBlockLayoutMa } } + private int getContentAreaIPD(List childLMs, Area childArea) { + int ipd = getContentAreaIPD(childLMs); + if (ipd == 0) { + return childArea.getEffectiveAllocIPD(); + } + return ipd; + } + + private int getContentAreaIPD(List childLMs) { + int ipd = 0; + for (LayoutManager childLM : childLMs) { + if (childLM instanceof TableLayoutManager) { + ipd += childLM.getContentAreaIPD(); + } else { + ipd += getContentAreaIPD(childLM.getChildLMs()); + } + } + return ipd; + } + /** * {Add info} * diff --git a/fop/test/layoutengine/standard-testcases/float_8.xml b/fop/test/layoutengine/standard-testcases/float_8.xml new file mode 100644 index 000000000..5c1d986f7 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/float_8.xml @@ -0,0 +1,67 @@ + + + + + +

+ This test checks floats. +

+
+ + + + + + + + + + + + + + + + + + + + + + YOUR POLICY INFORMATION + + + + + + + + + + Your bank has declined your payment + + + + + + + + + + +
-- 2.39.5