From 7b29d1d1354f07a5e2914c0f2711d50f7c2ff967 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Mon, 15 Apr 2024 14:54:14 +0100 Subject: [PATCH] FOP-3177: Remove space generated by fo:wrapper --- .../inline/WrapperLayoutManager.java | 10 ++++ .../standard-testcases/wrapper_space.xml | 53 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 fop/test/layoutengine/standard-testcases/wrapper_space.xml diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java index ff2c59f4a..c6a2b05b2 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java @@ -19,6 +19,9 @@ package org.apache.fop.layoutmgr.inline; +import java.util.Collections; +import java.util.List; + import org.apache.fop.area.Block; import org.apache.fop.area.inline.InlineArea; import org.apache.fop.fo.flow.Wrapper; @@ -87,4 +90,11 @@ public class WrapperLayoutManager extends LeafNodeLayoutManager { getPSLM().addIDToPage(fobj.getId()); } + public List getNextKnuthElements(LayoutContext context, int alignment) { + List list = super.getNextKnuthElements(context, alignment); + if (parentLayoutManager instanceof LineLayoutManager && !fobj.hasId() && fobj.hasChildren()) { + return Collections.emptyList(); + } + return list; + } } diff --git a/fop/test/layoutengine/standard-testcases/wrapper_space.xml b/fop/test/layoutengine/standard-testcases/wrapper_space.xml new file mode 100644 index 000000000..e90f3b1ae --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/wrapper_space.xml @@ -0,0 +1,53 @@ + + + + + +

+ This test checks fo:wrapper surrounding block-level content. +

+
+ + + + + + + + + + + + + + + + + + + + a + + + + + + + + +
-- 2.39.5