]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugfix: Added missing conditionality notification for table-cell content.
authorJeremias Maerki <jeremias@apache.org>
Wed, 30 Nov 2005 08:52:26 +0000 (08:52 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 30 Nov 2005 08:52:26 +0000 (08:52 +0000)
Extracted functionality to find a previous break into a helper method in ElementListUtils.
Fixed misguided german->english translation on parameter names (last != previous).

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@349909 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/ElementListUtils.java
src/java/org/apache/fop/layoutmgr/SpaceResolver.java
src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
status.xml

index c4fd42a353deac3d32b821ee1e32a75aa1edfe5e..e68698e57cfc9889a56f0b6008b7649a89210507 100644 (file)
@@ -146,4 +146,23 @@ public class ElementListUtils {
         return last.isForcedBreak();
     }
     
+    /**
+     * Determines the position of the previous break before the start index on an
+     * element list.
+     * @param elems the element list
+     * @param startIndex the start index
+     * @return the position of the previous break, or -1 if there was no previous break
+     */
+    public static int determinePreviousBreak(List elems, int startIndex) {
+        int prevBreak = startIndex - 1;
+        while (prevBreak >= 0) {
+            KnuthElement el = (KnuthElement)elems.get(prevBreak);
+            if (el.isPenalty() && el.getP() < KnuthElement.INFINITE) {
+                break;
+            }
+            prevBreak--;
+        }
+        return prevBreak;
+    }
+    
 }
index 45e9990ea2979204781907e42a4a5c3e7e267c91..583f8ffaa1d95e26fd5481ecd1b0c6be6ee680fd 100644 (file)
@@ -692,14 +692,14 @@ public class SpaceResolver {
      * @param effectiveList the effective element list
      * @param startElementIndex index of the first element in the part to be processed
      * @param endElementIndex index of the last element in the part to be processed
-     * @param lastBreak index of the the break possibility just before this part (used to
+     * @param prevBreak index of the the break possibility just before this part (used to
      *                  identify a break condition, lastBreak <= 0 represents a no-break condition)
      */
     public static void performConditionalsNotification(List effectiveList, 
-            int startElementIndex, int endElementIndex, int lastBreak) {
+            int startElementIndex, int endElementIndex, int prevBreak) {
         KnuthElement el = null;
-        if (lastBreak > 0) {
-            el = (KnuthElement)effectiveList.get(lastBreak);
+        if (prevBreak > 0) {
+            el = (KnuthElement)effectiveList.get(prevBreak);
         }
         SpaceResolver.SpaceHandlingBreakPosition beforeBreak = null;
         SpaceResolver.SpaceHandlingBreakPosition afterBreak = null;
index 5a98deac68b6adb87aca3b56b458f94ae2f01ddd..0ed202c6facbebc81736a8fe189a8e798a909cdc 100644 (file)
@@ -461,30 +461,15 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
         int bodyFirstIndex = ((ListItemPosition) positionList.getFirst()).getBodyFirstIndex();
         int bodyLastIndex = ((ListItemPosition) positionList.getLast()).getBodyLastIndex();
 
-        int lastBreak;
-        //Determine last break if any
-        lastBreak = labelFirstIndex - 1;
-        while (lastBreak >= 0) {
-            KnuthElement el = (KnuthElement)labelList.get(lastBreak);
-            if (el.isPenalty() && el.getP() < KnuthElement.INFINITE) {
-                break;
-            }
-            lastBreak--;
-        }
+        //Determine previous break if any
+        int previousBreak = ElementListUtils.determinePreviousBreak(labelList, labelFirstIndex);
         SpaceResolver.performConditionalsNotification(labelList, 
-                labelFirstIndex, labelLastIndex, lastBreak);
-
-        //Determine last break if any
-        lastBreak = bodyFirstIndex - 1;
-        while (lastBreak >= 0) {
-            KnuthElement el = (KnuthElement)bodyList.get(lastBreak);
-            if (el.isPenalty() && el.getP() < KnuthElement.INFINITE) {
-                break;
-            }
-            lastBreak--;
-        }
+                labelFirstIndex, labelLastIndex, previousBreak);
+
+        //Determine previous break if any
+        previousBreak = ElementListUtils.determinePreviousBreak(labelList, labelFirstIndex);
         SpaceResolver.performConditionalsNotification(bodyList, 
-                bodyFirstIndex, bodyLastIndex, lastBreak);
+                bodyFirstIndex, bodyLastIndex, previousBreak);
         
         // add label areas
         if (labelFirstIndex <= labelLastIndex) {
index 99028d915154e9f9e57edfee5227bacbd9bb5aad..9fabeccc55b94a58240908eca5e10b86e10f624f 100644 (file)
@@ -49,6 +49,7 @@ import org.apache.fop.layoutmgr.ListElement;
 import org.apache.fop.layoutmgr.MinOptMaxUtil;
 import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.PositionIterator;
+import org.apache.fop.layoutmgr.SpaceResolver;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.layoutmgr.SpaceResolver.SpaceHandlingBreakPosition;
 import org.apache.fop.traits.MinOptMax;
@@ -948,6 +949,9 @@ public class TableContentLayoutManager implements PercentBaseContext {
             cellLM.setContentHeight(contentHeight);
             cellLM.setRowHeight(effCellHeight);
             //cellLM.setRowHeight(row.getHeight().opt);
+            int prevBreak = ElementListUtils.determinePreviousBreak(pgu.getElements(), startPos);
+            SpaceResolver.performConditionalsNotification(pgu.getElements(), 
+                    startPos, endPos, prevBreak);
             cellLM.addAreas(new KnuthPossPosIter(pgu.getElements(), 
                     startPos, endPos + 1), layoutContext);
         }
index 20e120e6afee594ee480cc1916d8b07951171eb0..a6a1e7334decd4e86ac38508ba8bbd06ab56ee2e 100644 (file)
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="fix">
+        Bugfix: Space resolution was incomplete for content in table-cells. Conditional elements
+        didn't get removed.
+      </action>
+      <action contexn="Code" dev="JM" type="fix">
+        The validation check for non-zero borders and padding on a region-* is now turned off
+        when relaxed validation is active to improve compatibility with FO documents written 
+        for other FO implementations.
+      </action>
+      <action context="Code" dev="JM" type="fix">
+        Bugfix for "/ by zero" ArithmeticExceptions when an URL to a non-existing image is used 
+        and content-width and/or content-height is used.
+      </action>
       <action context="Code" dev="JM" type="fix">
         Bugfix for a multi-threading problem:
         propertyListTable initialization moved from the constructor to a static block in FONode.