From f9e031ace069602f5a67222b32e2f1ce3fdc54fc Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Tue, 30 Jul 2024 11:25:57 +0100 Subject: [PATCH] FOP-3195: Skip written block ipds inside float --- .../layoutmgr/AbstractBaseLayoutManager.java | 8 +-- .../layoutmgr/FloatContentLayoutManager.java | 2 +- .../standard-testcases/float_10.xml | 57 +++++++++++++++++++ 3 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 fop/test/layoutengine/standard-testcases/float_10.xml diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java index a3edc2088..dba4723c9 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java @@ -209,14 +209,8 @@ public abstract class AbstractBaseLayoutManager "getContentAreaIPD() called when it should have been overridden"); } - /** - * {@inheritDoc} - * NOTE: Should be overridden by subclasses. - * Default implementation throws an UnsupportedOperationException. - */ public int getContentAreaBPD() { - throw new UnsupportedOperationException( - "getContentAreaBPD() called when it should have been overridden"); + return 0; } /** {@inheritDoc} */ 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 b489760ce..8a82f2398 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 @@ -113,7 +113,7 @@ public class FloatContentLayoutManager extends SpacedBorderedPaddedBlockLayoutMa for (LayoutManager childLM : childLMs) { if (childLM instanceof TableLayoutManager) { ipd += childLM.getContentAreaIPD(); - } else { + } else if (childLM.getContentAreaBPD() != -1) { ipd += getContentAreaIPD(childLM.getChildLMs()); } } diff --git a/fop/test/layoutengine/standard-testcases/float_10.xml b/fop/test/layoutengine/standard-testcases/float_10.xml new file mode 100644 index 000000000..5969c6626 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/float_10.xml @@ -0,0 +1,57 @@ + + + +

+ Test position of float containing tables +

+
+ + + + + + + + + + + + + + + + + + + + Visit My Account + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file -- 2.39.5