aboutsummaryrefslogtreecommitdiffstats
path: root/fop-core
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2020-05-05 08:12:02 +0000
committerSimon Steiner <ssteiner@apache.org>2020-05-05 08:12:02 +0000
commit22b5573fe407e09746a701b52bcd0ffe274d8dbd (patch)
tree8936e24e1a4cec28c5ae4fc48745bb0d271fed5d /fop-core
parentccd1b149a719ce315ffe885fc153fce25d139fd5 (diff)
downloadxmlgraphics-fop-22b5573fe407e09746a701b52bcd0ffe274d8dbd.tar.gz
xmlgraphics-fop-22b5573fe407e09746a701b52bcd0ffe274d8dbd.zip
FOP-2934: Absolute element should not be removed
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1877372 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-core')
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java16
2 files changed, 14 insertions, 4 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index f0fc77577..dced73317 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -161,7 +161,7 @@ public class BlockContainerLayoutManager extends SpacedBorderedPaddedBlockLayout
return indents;
}
- private boolean isAbsoluteOrFixed() {
+ protected boolean isAbsoluteOrFixed() {
return (abProps.absolutePosition == EN_ABSOLUTE
|| abProps.absolutePosition == EN_FIXED);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java
index e0f2daea0..9b964843e 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java
@@ -229,10 +229,20 @@ public final class ElementListUtils {
public static boolean isEmptyBox(List elements) {
if (elements.size() == 1 && elements.get(0) instanceof KnuthBox) {
KnuthBox kb = (KnuthBox) elements.get(0);
- if (kb.getWidth() == 0) {
- return true;
- }
+ return kb.getWidth() == 0 && !isAbsoluteOrFixed(kb.getPosition());
}
return false;
}
+
+ private static boolean isAbsoluteOrFixed(Position pos) {
+ if (pos == null || pos == pos.getPosition()) {
+ return false;
+ }
+ LayoutManager lm = pos.getLM();
+ if (lm instanceof BlockContainerLayoutManager && ((BlockContainerLayoutManager)lm).isAbsoluteOrFixed()) {
+ return true;
+ }
+ return isAbsoluteOrFixed(pos.getPosition());
+ }
+
}