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 2006/07/13 14:08:52 UTC

svn commit: r421600 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr: BreakingAlgorithm.java PageBreakingAlgorithm.java

Author: jeremias
Date: Thu Jul 13 05:08:52 2006
New Revision: 421600

URL: http://svn.apache.org/viewvc?rev=421600&view=rev
Log:
Fixed removeNode() as discussed on fop-dev. No more checks for footnotes and removal of nodes even if they are not in the normally expected order.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=421600&r1=421599&r2=421600&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Thu Jul 13 05:08:52 2006
@@ -1010,19 +1010,29 @@
     }
 
     /**
-     * Remove the first active node registered for the given line. If there is no more active node
+     * Remove the given active node registered for the given line. If there are no more active nodes
      * for this line, adjust the startLine accordingly.
      * @param line number of the line ending at the node's corresponding breakpoint
      * @param node the node to deactivate
      */
     protected void removeNode(int line, KnuthNode node) {
+        int headIdx = line * 2;
         KnuthNode n = getNode(line);
         if (n != node) {
-            log.error("Should be first");
+            // nodes could be rightly deactivated in a different order
+            KnuthNode prevNode = null;
+            while (n != node) {
+                prevNode = n;
+                n = n.next;
+            }
+            prevNode.next = n.next;
+            if (prevNode.next == null) {
+                activeLines[headIdx + 1] = prevNode;
+            }
         } else {
-            activeLines[line * 2] = node.next;
+            activeLines[headIdx] = node.next;
             if (node.next == null) {
-                activeLines[line * 2 + 1] = null;
+                activeLines[headIdx + 1] = null;
             }
             while (startLine < endLine && getNode(startLine) == null) {
                 startLine++;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=421600&r1=421599&r2=421600&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Thu Jul 13 05:08:52 2006
@@ -713,35 +713,6 @@
         removeNode(prevNode.line, prevNode);
     }
 
-    protected void removeNode(int line, KnuthNode node) {
-        KnuthNode n = getNode(line);
-        if (n != node) {
-            if (footnotesPending) {
-                // nodes could be rightly deactivated in a different order
-                KnuthNode prevNode = null;
-                while (n != node) {
-                    prevNode = n;
-                    n = n.next;
-                }
-                prevNode.next = n.next;
-                if (prevNode.next == null) {
-                    activeLines[line * 2 + 1] = prevNode;
-                }
-            } else {
-                log.error("Should be first");
-            }
-        } else {
-            activeLines[line * 2] = node.next;
-            if (node.next == null) {
-                activeLines[line * 2 + 1] = null;
-            }
-            while (startLine < endLine && getNode(startLine) == null) {
-                startLine++;
-            }
-        }
-        activeNodeCount--;
-    }
-    
     /**
      * @return a list of PageBreakPosition elements
      */



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