aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-07-13 12:08:52 +0000
committerJeremias Maerki <jeremias@apache.org>2006-07-13 12:08:52 +0000
commit0a03fe4a2f285a901803a11c7bccd7cc541cfff9 (patch)
treee714fad1a3397364cf620927aae9179d8260b526 /src/java/org
parent15d2d6246456f7b48581f2503c2edfafe0c1efb2 (diff)
downloadxmlgraphics-fop-0a03fe4a2f285a901803a11c7bccd7cc541cfff9.tar.gz
xmlgraphics-fop-0a03fe4a2f285a901803a11c7bccd7cc541cfff9.zip
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.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@421600 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java18
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java29
2 files changed, 14 insertions, 33 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
index 1ad7db986..a0f58db13 100644
--- a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
@@ -1010,19 +1010,29 @@ public abstract class BreakingAlgorithm {
}
/**
- * 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++;
diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
index 2be63eb7f..acf46ef64 100644
--- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
@@ -713,35 +713,6 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
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
*/