]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fixed the handling of columns in the border resolution, especially in case of column...
authorVincent Hennebert <vhennebert@apache.org>
Thu, 13 Dec 2007 18:28:56 +0000 (18:28 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Thu, 13 Dec 2007 18:28:56 +0000 (18:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@603968 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java
src/java/org/apache/fop/fo/flow/table/TableCell.java
test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml
test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml

index f92f7bb30b08235dffa167fe5f26e8cb87249d10..f59019b923d001620d6c3bc15a42d7130e219c0d 100644 (file)
@@ -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);
         }
 
index f85d0e97e73eef01337bbd2f95650352f0554bbb..80dbe5e2a13b44ee35cf9273fc8be0eb3e89ec54 100644 (file)
@@ -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} */
index 6aa054d7d716601a88e83b373c3bb0538632f06a..20cabace2bac25ebd1a2eb330ccd937c32b2bb9c 100644 (file)
             </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>
     <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>
index b9b5c49b96e7b58b9d8b0229f6050a0b1d9382a3..c0538b2e0b1529f0276a373d15640f1e4d086363 100644 (file)
@@ -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>