From 41f044b6f7f120cb04833bfb3d2ace75cac32818 Mon Sep 17 00:00:00 2001
From: Jeremias Maerki
Date: Fri, 14 Mar 2008 14:41:03 +0000
Subject: [PATCH] Bugzilla #44412: Bugfix: The before border of a block is no
longer swallowed if its first child issues a break-before.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95@637119 13f79535-47bb-0310-9956-ffa450edef68
---
.../layoutmgr/BlockStackingLayoutManager.java | 13 +++-
status.xml | 4 ++
.../block_break-before_bug44412.xml | 64 +++++++++++++++++++
3 files changed, 79 insertions(+), 2 deletions(-)
create mode 100644 test/layoutengine/standard-testcases/block_break-before_bug44412.xml
diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index 96e2c82fb..98606bd1f 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -294,15 +294,24 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
if (returnedList != null
&& returnedList.size() == 1
&& ((ListElement) returnedList.getFirst()).isForcedBreak()) {
- // a descendant of this block has break-before
- contentList.addAll(returnedList);
if (curLM.isFinished() && !hasNextChildLM()) {
+ // a descendant of this block has break-before
+ contentList.addAll(returnedList);
+
forcedBreakAfterLast = (BreakElement)contentList.removeLast();
context.clearPendingMarks();
break;
}
+ if (contentList.size() == 0) {
+ // Empty fo:block, zero-length box makes sure the IDs and/or markers
+ // are registered and borders/padding are painted.
+ returnList.add(new KnuthBox(0, notifyPos(new Position(this)), false));
+ }
+ // a descendant of this block has break-before
+ contentList.addAll(returnedList);
+
/* extension: conversione di tutta la sequenza fin'ora ottenuta */
if (bpUnit > 0) {
storedList = contentList;
diff --git a/status.xml b/status.xml
index ac9d6a9cc..8864a8dc4 100644
--- a/status.xml
+++ b/status.xml
@@ -116,6 +116,10 @@
+
+ Bugfix: The before border of a block is no longer swallowed if its first child issues
+ a break-before.
+
Bugfix: When there was a forced break after a block with (conditional) borders the
border-after wasn't painted.
diff --git a/test/layoutengine/standard-testcases/block_break-before_bug44412.xml b/test/layoutengine/standard-testcases/block_break-before_bug44412.xml
new file mode 100644
index 000000000..9ef4150b5
--- /dev/null
+++ b/test/layoutengine/standard-testcases/block_break-before_bug44412.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+ This test checks Bugzilla #44412 where a break-before on the first child of an otherwise
+ empty block is set. It is expected that the parent block creates two areas, the first with
+ only border-before on the first page and zero bpd.
+
+
+
+
+
+
+
+
+
+
+
+ Before the block
+
+ The break-before set on this block causes the parent
+ block to produce an empty block area with only a border before on the
+ first page.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3
+
+
+
--
2.39.5