From: Vincent Hennebert Date: Thu, 26 Apr 2007 15:32:37 +0000 (+0000) Subject: Fix a NPE when break-before is specified on the first row of a table, and when that... X-Git-Tag: fop-0_94~117 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=361470baa8019e77f2942c0c0997f1f00c5f08b7;p=xmlgraphics-fop.git Fix a NPE when break-before is specified on the first row of a table, and when that row contains a row-spanning cell. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@532780 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index c3e1a41da..9794c7310 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -69,7 +69,6 @@ public class TableContentLayoutManager implements PercentBaseContext { private LinkedList footerList; private int headerNetHeight = 0; private int footerNetHeight = 0; - private boolean firstBreakBeforeServed = false; private int startXOffset; private int usedBPD; @@ -220,16 +219,10 @@ public class TableContentLayoutManager implements PercentBaseContext { breakPoss.setBreakClass(rowFO.getBreakBefore()); } } else { - if (!firstBreakBeforeServed) { - returnList.add(new BreakElement(new Position(getTableLM()), - 0, -KnuthPenalty.INFINITE, rowFO.getBreakBefore(), context)); - iter.backToPreviousRow(); - firstBreakBeforeServed = true; - break; - } + returnList.add(new BreakElement(new Position(getTableLM()), + 0, -KnuthPenalty.INFINITE, rowFO.getBreakBefore(), context)); } } - firstBreakBeforeServed = true; //Border resolution if (!isSeparateBorderModel()) { diff --git a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java index f8cedd7de..0f7604f20 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java @@ -211,13 +211,6 @@ public class TableRowIterator { return getRow(row.getIndex() + 1); } - /** - * Sets the iterator to the previous row. - */ - public void backToPreviousRow() { - iteratorIndex--; - } - /** * Returns the first effective row. * @return the requested effective row. diff --git a/test/layoutengine/standard-testcases/table-row_break-before_row-span.xml b/test/layoutengine/standard-testcases/table-row_break-before_row-span.xml new file mode 100644 index 000000000..2bc054565 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-row_break-before_row-span.xml @@ -0,0 +1,78 @@ + + + + + +

+ This test checks that break-before on the first row of a table, when it contains row-spanning + cells, works correctly. +

+
+ + + + + + + + + + Before the table + + + + + + Cell 1.1 + + + Cell 1.2 + + + + + Cell 2.2 + + + + + Cell 3.1 + + + Cell 3.2 + + + + + After the table + + + + + + + + + + + + + + +