diff options
4 files changed, 60 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java b/src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java index f92f7bb30..f59019b92 100644 --- a/src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java +++ b/src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java @@ -205,14 +205,22 @@ class CollapsingBorderResolver implements BorderResolver { // Resolve start/end borders in the row Iterator guIter = row.iterator(); GridUnit gu = (GridUnit) guIter.next(); + Iterator colIter = table.getColumns().iterator(); + TableColumn col = (TableColumn) colIter.next(); + gu.integrateBorderSegment(CommonBorderPaddingBackground.START, col); gu.integrateBorderSegment(CommonBorderPaddingBackground.START, container); while (guIter.hasNext()) { - GridUnit guEnd = (GridUnit) guIter.next(); + GridUnit nextGU = (GridUnit) guIter.next(); + TableColumn nextCol = (TableColumn) colIter.next(); if (gu.isLastGridUnitColSpan()) { - gu.resolveBorder(guEnd, CommonBorderPaddingBackground.END); + gu.integrateBorderSegment(CommonBorderPaddingBackground.END, col); + nextGU.integrateBorderSegment(CommonBorderPaddingBackground.START, nextCol); + gu.resolveBorder(nextGU, CommonBorderPaddingBackground.END); } - gu = guEnd; + gu = nextGU; + col = nextCol; } + gu.integrateBorderSegment(CommonBorderPaddingBackground.END, col); gu.integrateBorderSegment(CommonBorderPaddingBackground.END, container); } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCell.java b/src/java/org/apache/fop/fo/flow/table/TableCell.java index f85d0e97e..80dbe5e2a 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCell.java @@ -138,15 +138,8 @@ public class TableCell extends TableFObj { protected void setCollapsedBorders() { createBorder(CommonBorderPaddingBackground.BEFORE); createBorder(CommonBorderPaddingBackground.AFTER); - Table table = getTable(); - if (table.hasExplicitColumns()) { - TableColumn col = table.getColumn(getColumnNumber() - 1); - createBorder(CommonBorderPaddingBackground.START, col); - createBorder(CommonBorderPaddingBackground.END, col); - } else { - createBorder(CommonBorderPaddingBackground.START); - createBorder(CommonBorderPaddingBackground.END); - } + createBorder(CommonBorderPaddingBackground.START); + createBorder(CommonBorderPaddingBackground.END); } /** {@inheritDoc} */ diff --git a/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml b/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml index 6aa054d7d..20cabace2 100644 --- a/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml +++ b/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml @@ -166,6 +166,30 @@ </fo:table-body> </fo:table> + <!-- table 3 --> + <fo:block space-before="10pt" space-after="10pt">Between tables</fo:block> + <fo:table table-layout="fixed" width="200pt" border-collapse="collapse"> + <fo:table-column column-width="proportional-column-width(1)" + border="6pt solid blue"/> + <fo:table-column column-width="proportional-column-width(1)" + border="8pt solid red"/> + <fo:table-body> + <fo:table-row> + <fo:table-cell number-columns-spanned="2" border="1pt solid black"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell border="1pt solid black"> + <fo:block>Cell 2.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black"> + <fo:block>Cell 2.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>After the tables</fo:block> </fo:flow> </fo:page-sequence> @@ -333,5 +357,26 @@ <eval expected="(solid,#ffff00,1000,collapse-inner)" xpath="//flow/block[4]/block[22]/@border-start"/> <eval expected="(solid,#000000,10000,collapse-outer)" xpath="//flow/block[4]/block[22]/@border-end"/> + <!-- table 3 --> + <!-- cell 1.1 --> + <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[1]/@border-before"/> + <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[1]/@border-after"/> + <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[1]/@border-start"/> + <eval expected="" xpath="//flow/block[6]/block[1]/@border-end"/> + <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[2]/@border-before"/> + <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[2]/@border-after"/> + <eval expected="" xpath="//flow/block[6]/block[2]/@border-start"/> + <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[2]/@border-end"/> + <!-- cell 2.1 --> + <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[4]/@border-before"/> + <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[4]/@border-after"/> + <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[4]/@border-start"/> + <eval expected="(solid,#ff0000,8000,collapse-inner)" xpath="//flow/block[6]/block[4]/@border-end"/> + <!-- cell 2.2 --> + <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[5]/@border-before"/> + <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[5]/@border-after"/> + <eval expected="(solid,#ff0000,8000,collapse-inner)" xpath="//flow/block[6]/block[5]/@border-start"/> + <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[5]/@border-end"/> + </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml b/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml index b9b5c49b9..c0538b2e0 100644 --- a/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml +++ b/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml @@ -20,7 +20,8 @@ <!-- NOTE: this test is a copy of table_border-collapse_collapse_resolution.xml, with all of the fo:table-column elements removed. The checks for the borders in the second column of the first - table have been changed accordingly (no more column which plays in the resolution). + table have been changed accordingly (no more column which plays in the resolution), and the third + table has been removed (not applicable when there are no columns). --> <testcase> <info> |