From ff6508e118c14d1e8eb270a559d147e85bf0418f Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Mon, 19 Nov 2012 16:57:05 +0000 Subject: 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 --- src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java | 4 ++++ .../org/apache/fop/layoutmgr/PageBreakingAlgorithm.java | 13 +++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src/java/org') 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() { -- cgit v1.2.3