From: Vincent Hennebert Date: Mon, 19 Nov 2012 16:57:05 +0000 (+0000) Subject: Bugzilla #54167: Disable the overflow recovery mechanism when the flow IPD changes X-Git-Tag: fop-2_0~265 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ff6508e118c14d1e8eb270a559d147e85bf0418f;p=xmlgraphics-fop.git Bugzilla #54167: Disable the overflow recovery mechanism when the flow IPD changes git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1411306 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java index 3830878fe..02c3db6a8 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java @@ -460,6 +460,10 @@ public abstract class BreakingAlgorithm { return this.partOverflowRecoveryActivated; } + protected KnuthNode getLastTooLong() { + return lastTooLong; + } + /** * Empty method, hook for subclasses. Called before determining the optimal * breakpoints corresponding to a given active node. diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java index 89bc339bc..4fa138da5 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java @@ -1108,6 +1108,19 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { } + @Override + protected KnuthNode recoverFromOverflow() { + if (compareIPDs(getLastTooLong().line - 1) != 0) { + /** + * If the IPD of the next page changes, disable the recovery mechanism as the + * inline content has to be re-laid out according to the new IPD anyway. + */ + return getLastTooLong(); + } else { + return super.recoverFromOverflow(); + } + } + /** {@inheritDoc} */ @Override protected int getIPDdifference() { diff --git a/test/layoutengine/standard-testcases/flow_changing-ipd_overflow.xml b/test/layoutengine/standard-testcases/flow_changing-ipd_overflow.xml new file mode 100644 index 000000000..ff44aba33 --- /dev/null +++ b/test/layoutengine/standard-testcases/flow_changing-ipd_overflow.xml @@ -0,0 +1,58 @@ + + + + + +

+ The overflow recovery mechanism must be disabled when the flow IPD changes. +

+
+ + + + + + + + + + + + + + + + + + + + This block-container overflows the page. + + After the big block-container. + + + + + + + + + +