You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/12/08 15:56:06 UTC

svn commit: r355105 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/layoutmgr/table/ test/layoutengine/ test/layoutengine/standard-testcases/

Author: jeremias
Date: Thu Dec  8 06:55:53 2005
New Revision: 355105

URL: http://svn.apache.org/viewcvs?rev=355105&view=rev
Log:
Bugfix: Areas for table-cells that are broken over more than one page are now generated even if all its content is already painted on a previous page. This fixes strange effects like a table grid that is not completely painted.
Some check in the test cases had to be adjusted because the indices weren't correct anymore, since now some previously missing areas are generated.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
    xmlgraphics/fop/trunk/status.xml
    xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_height_page-break.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_border_padding_2.xml
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=355105&r1=355104&r2=355105&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Thu Dec  8 06:55:53 2005
@@ -762,6 +762,7 @@
         public RowPainter(LayoutContext layoutContext) {
             this.layoutContext = layoutContext;
             Arrays.fill(firstRow, -1);
+            Arrays.fill(end, -1);
         }
         
         public int getAccumulatedBPD() {
@@ -898,7 +899,8 @@
                 GridUnit currentGU = lastRow.safelyGetGridUnit(i);
                 if ((gridUnits[i] != null) 
                         && (forcedFlush || ((end[i] == gridUnits[i].getElements().size() - 1))
-                                && (currentGU == null || currentGU.isLastGridUnitRowSpan()))) {
+                                && (currentGU == null || currentGU.isLastGridUnitRowSpan()))
+                    || (gridUnits[i] == null && currentGU != null)) {
                     //the last line in the "if" above is to avoid a premature end of an 
                     //row-spanned cell because no GridUnitParts are generated after a cell is
                     //finished with its content. currentGU can be null if there's no grid unit
@@ -907,13 +909,22 @@
                         log.debug((forcedFlush ? "FORCED " : "") + "flushing..." + i + " " 
                                 + start[i] + "-" + end[i]);
                     }
-                    addAreasForCell(gridUnits[i], start[i], end[i], 
-                            lastRow,  
-                            partLength[i], actualRowHeight);
-                    gridUnits[i] = null;
-                    start[i] = 0;
-                    end[i] = 0;
-                    partLength[i] = 0;
+                    PrimaryGridUnit gu = gridUnits[i];
+                    if (gu == null 
+                            && !currentGU.isEmpty() 
+                            && currentGU.getColSpanIndex() == 0 
+                            && currentGU.isLastGridUnitColSpan()) {
+                        gu = currentGU.getPrimary();
+                    }
+                    if (gu != null) {
+                        addAreasForCell(gu, start[i], end[i], 
+                                lastRow,  
+                                partLength[i], actualRowHeight);
+                        gridUnits[i] = null;
+                        start[i] = 0;
+                        end[i] = -1;
+                        partLength[i] = 0;
+                    }
                 }
             }
             return actualRowHeight;
@@ -950,8 +961,10 @@
             cellLM.setRowHeight(effCellHeight);
             //cellLM.setRowHeight(row.getHeight().opt);
             int prevBreak = ElementListUtils.determinePreviousBreak(pgu.getElements(), startPos);
-            SpaceResolver.performConditionalsNotification(pgu.getElements(), 
-                    startPos, endPos, prevBreak);
+            if (endPos >= 0) {
+                SpaceResolver.performConditionalsNotification(pgu.getElements(), 
+                        startPos, endPos, prevBreak);
+            }
             cellLM.addAreas(new KnuthPossPosIter(pgu.getElements(), 
                     startPos, endPos + 1), layoutContext);
         }

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/status.xml?rev=355105&r1=355104&r2=355105&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Thu Dec  8 06:55:53 2005
@@ -27,6 +27,11 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="fix">
+        Bugfix: Areas for table-cells that are broken over more than one page are now
+        generated even if all its content is already painted on a previous page. This
+        fixes strange effects like a table grid that is not completely painted.
+      </action>
       <action context="Code" dev="JM" type="fix" fixes-bug="37828">
         Bugfix: Column balancing produced strange break decisions in certain multi-column
         documents with large amounts of text.

Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml?rev=355105&r1=355104&r2=355105&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Thu Dec  8 06:55:53 2005
@@ -260,8 +260,7 @@
     <name>Problems with border and padding on tables</name>
     <file>table_border_padding.xml</file>
     <description>The element list seems to not be fully correct, yet, causing
-    the layout to look odd. Furthermore, an already finished cell doesn't produce
-    an area on the next page when the table-row is broken over multiple pages.</description>
+    the layout to look odd.</description>
   </testcase>
   <testcase>
     <name>keep-with-previous doesn't work inside tables</name>

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_height_page-break.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_height_page-break.xml?rev=355105&r1=355104&r2=355105&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_height_page-break.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_height_page-break.xml Thu Dec  8 06:55:53 2005
@@ -81,7 +81,7 @@
     <eval expected="cell4e" xpath="//pageViewport[1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[4]/block[1]/block[5]/lineArea"/>
 
     <!-- page 2 -->
-    <eval expected="cell4f" xpath="//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/block[1]/block[1]/lineArea"/>
-    <eval expected="cell4g" xpath="//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/block[1]/block[2]/lineArea"/>
+    <eval expected="cell4f" xpath="//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block[1]/block[1]/lineArea"/>
+    <eval expected="cell4g" xpath="//pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block[1]/block[2]/lineArea"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_border_padding_2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_border_padding_2.xml?rev=355105&r1=355104&r2=355105&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_border_padding_2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_border_padding_2.xml Thu Dec  8 06:55:53 2005
@@ -39,7 +39,7 @@
             <fo:table-column column-width="proportional-column-width(9)"/>
             <fo:table-body>
               <fo:table-row>
-                <fo:table-cell background-color="yellow">
+                <fo:table-cell background-color="yellow" id="cell1a">
                   <fo:block>cell1</fo:block>
                 </fo:table-cell>
                 <fo:table-cell background-color="orange">
@@ -69,7 +69,7 @@
             <fo:table-column column-width="proportional-column-width(9)"/>
             <fo:table-body>
               <fo:table-row>
-                <fo:table-cell background-color="yellow">
+                <fo:table-cell background-color="yellow" id="cell1b">
                   <fo:block>cell1</fo:block>
                 </fo:table-cell>
                 <fo:table-cell background-color="orange">
@@ -199,5 +199,11 @@
 
     <eval expected="(solid,#000000,5000)" xpath="//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-after"/>
     <eval expected="20000" xpath="//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-after"/>
+    
+    <!-- Additional check: areas for table-cells which are finished but its row continues on the subsequent page -->
+    <true xpath="boolean(//pageViewport[@nr=1]//block[@prod-id='cell1a'])"/>
+    <true xpath="boolean(//pageViewport[@nr=2]//block[@prod-id='cell1a'])"/>
+    <true xpath="boolean(//pageViewport[@nr=3]//block[@prod-id='cell1b'])"/>
+    <true xpath="boolean(//pageViewport[@nr=4]//block[@prod-id='cell1b'])"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml?rev=355105&r1=355104&r2=355105&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml Thu Dec  8 06:55:53 2005
@@ -97,8 +97,8 @@
     <eval expected="1" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
     <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
     <eval expected="2" xpath="count(//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block)"/>
-    <eval expected="2" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/block)"/>
-    <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/block)"/>
+    <eval expected="2" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block)"/>
+    <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block)"/>
     
   </checks>
 </testcase>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org