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 2007/03/23 14:08:33 UTC

svn commit: r521713 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/table/RowPainter.java test/layoutengine/standard-testcases/table-cell_number-rows-spanned_bug38397.xml

Author: jeremias
Date: Fri Mar 23 06:08:32 2007
New Revision: 521713

URL: http://svn.apache.org/viewvc?view=rev&rev=521713
Log:
Better document some of the code in RowPainter.
Added a check in table-cell_number-rows-spanned_bug38397.xml which is the reason for one of the if-branches in RowPainter. It wan't tested previously so that if-branch could easily be mistaken to be useless.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_number-rows-spanned_bug38397.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java?view=diff&rev=521713&r1=521712&r2=521713
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowPainter.java Fri Mar 23 06:08:32 2007
@@ -48,6 +48,11 @@
      * part present on the current page.
      */
     private int[] firstRow = new int[3];
+    /**
+     * Keeps track of the y-offsets of each row on a page (for body, header and footer separately).
+     * This is particularly needed for spanned cells where you need to know the y-offset
+     * of the starting row when the area is generated at the time the cell is closed.
+     */
     private Map[] rowOffsets = new Map[] {new java.util.HashMap(),
             new java.util.HashMap(), new java.util.HashMap()};
 
@@ -237,17 +242,26 @@
         tclm.addRowBackgroundArea(rowFO, actualRowHeight, layoutContext.getRefIPD(), yoffset);
         for (int i = 0; i < primaryGridUnits.length; i++) {
             GridUnit currentGU = lastRow.safelyGetGridUnit(i);
+            //currentGU can be null if there's no grid unit
+            //at this place in the current row (empty cell and no borders to process)
+            
             if ((primaryGridUnits[i] != null)
                     && (forcedFlush || (end[i] == primaryGridUnits[i].getElements().size() - 1)
-                            && (currentGU == null || currentGU.isLastGridUnitRowSpan()))
-                || (primaryGridUnits[i] == null && currentGU != null)) {
-                //the last line in the "if" above is to avoid a premature end of an
+                            && /*[1]*/ (currentGU == null || currentGU.isLastGridUnitRowSpan()))
+                || /*[2]*/ (primaryGridUnits[i] == null && currentGU != null)) {
+                
+                //[1] the last line in the "if" above is to avoid a premature end of a
                 //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
-                //at this place in the current row (empty cell and no borders to process)
+                //finished with its content.
+                //See table-cell_number-rows-spanned_bug38397.xml
+                
+                //[2] A row-spanned cell has finished contributing content on the previous page
+                //and now still has to cause grid units to be painted.
+                //See table-cell_page-break_span.xml
+                
                 if (log.isDebugEnabled()) {
-                    log.debug((forcedFlush ? "FORCED " : "") + "flushing..." + i + " "
-                            + start[i] + "-" + end[i]);
+                    log.debug((forcedFlush ? "FORCED " : "") + "flushing... col=" + i 
+                            + " elem-list:" + start[i] + "-" + end[i]);
                 }
                 PrimaryGridUnit gu = primaryGridUnits[i];
                 if (gu == null
@@ -282,6 +296,8 @@
         //Determine y offset for the cell
         Integer offset = (Integer)rowOffsets[bt].get(new Integer(startRow));
         while (offset == null) {
+            //TODO Figure out what this does and when it's triggered
+            //This block is probably never used, at least it's not triggered by any of our tests
             startRow--;
             offset = (Integer)rowOffsets[bt].get(new Integer(startRow));
         }

Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_number-rows-spanned_bug38397.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_number-rows-spanned_bug38397.xml?view=diff&rev=521713&r1=521712&r2=521713
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_number-rows-spanned_bug38397.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_number-rows-spanned_bug38397.xml Fri Mar 23 06:08:32 2007
@@ -39,7 +39,7 @@
             <fo:table-column column-width="proportional-column-width(2)"/>
             <fo:table-body>
               <fo:table-row>
-                <fo:table-cell number-rows-spanned="3" number-columns-spanned="2" display-align="center" border="solid 0.5pt">
+                <fo:table-cell id="cell1" number-rows-spanned="3" number-columns-spanned="2" display-align="center" border="solid 0.5pt">
                   <fo:block>cell1</fo:block>
                 </fo:table-cell>
                 <fo:table-cell number-rows-spanned="2" display-align="center" border="solid 0.5pt">
@@ -94,5 +94,6 @@
   </fo>
   <checks>
     <eval expected="1" xpath="count(//pageViewport)"/>
+    <eval expected="45200" xpath="//block[@prod-id = 'cell1']/@bpd"/>
   </checks>
 </testcase>



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