]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugfix in tables: wrong element generation by the merging algorithm when glues must...
authorVincent Hennebert <vhennebert@apache.org>
Tue, 20 Nov 2007 16:07:32 +0000 (16:07 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Tue, 20 Nov 2007 16:07:32 +0000 (16:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@596727 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableStepper.java
status.xml
test/layoutengine/standard-testcases/table-cell_conditional-spaces_1.xml

index 7a92dbfd6717a11f7865515b71ab53f07adad2c0..98b07778f7572ba1650da74357bc93232aa49acf 100644 (file)
@@ -156,15 +156,15 @@ public class TableStepper {
         boolean signalKeepWithNext = false;
         int laststep = 0;
         int step;
-        int addedBoxLen = 0;
+        int cumulateLength = 0; // Length of the content accumulated before the break
         TableContentPosition lastTCPos = null;
         LinkedList returnList = new LinkedList();
         while ((step = getNextStep()) >= 0) {
             int normalRow = activeRowIndex;
             int increase = step - laststep;
             int penaltyOrGlueLen = step + getMaxRemainingHeight() - totalHeight;
-            int boxLen = step - addedBoxLen - Math.max(0, penaltyOrGlueLen);
-            addedBoxLen += boxLen;
+            int boxLen = step - cumulateLength - Math.max(0, penaltyOrGlueLen)/* the penalty, if any */;
+            cumulateLength += boxLen + Math.max(0, -penaltyOrGlueLen)/* the glue, if any */;
 
             boolean forcedBreak = false;
             int breakClass = -1;
index 3e4ad4b55799b6ca24221eec7b7f6faef02a8e86..9074871234fa46be50938342fbdd802900f8a21c 100644 (file)
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="VH" type="fix">
+        Bugfix in tables: wrong element generation by the merging algorithm when glues must be
+        produced to cope with conditional spaces. The corresponding length was added twice: one in
+        the glue itself and one in the following box.
+      </action>
       <action context="Code" dev="JM" type="fix">
         Bugfix for URI resolution: Make StreamSources without system identifier work again.
       </action>
@@ -35,8 +40,8 @@
         Avoid a NullPointerException in AreaTreeHandler.endDocument().
       </action>
       <action context="Code" dev="VH" type="fix" fixes-bug="43766">
-        Bugfix: breaks generated by the merging algorithm for a table-row containing empty cells had always a
-        penalty of 900.
+        Bugfix: breaks generated by the merging algorithm for a table-row containing empty cells
+        had always a penalty of 900.
       </action>
       <action context="Code" dev="JM" type="add" fixes-bug="43605" due-to="V. Schappert">
         Added methods for fo:page-number-citation(-last) in FOEventHandler.
index a540cfefbcdffb3bec900fd6560bb6d6301a1108..3aa9d88714288103edea5e99fcd9a682ef6f7b5d 100644 (file)
     <eval expected="31800" xpath="//pageViewport[8]//flow/block[2]/block/@bpd"/>
     <eval expected="16800" xpath="//pageViewport[9]//flow/block/@bpd"/>
     <eval expected="16800" xpath="//pageViewport[9]//flow/block/block/@bpd"/>
+
+    <element-list category="breaker">
+      <skip>3</skip>              <!-- The block before the table -->
+      <penalty p="INF" w="0"/>
+      <glue w="4000"/>            <!-- The border before -->
+      <box w="16800"/>            <!-- Line 1 -->
+      <penalty p="0" w="0"/>
+      <glue w="25000"/>           <!-- The space between lines -->
+      <box w="16800"/>            <!-- Line 2 -->
+      <skip>3</skip>              <!-- glue for end of page TODO missing element for border-after!! -->
+    </element-list>
   </checks>
 </testcase>