From: Simon Steiner Date: Fri, 16 Mar 2018 11:42:38 +0000 (+0000) Subject: FOP-2776: NoSuchElementException for list changing ipd X-Git-Tag: fop-2_3~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a3a3995f8b6f271e57bcd87e2a03f45da2f04c16;p=xmlgraphics-fop.git FOP-2776: NoSuchElementException for list changing ipd git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1826976 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index 094caaf3d..69b78c9bc 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -36,6 +36,7 @@ import org.apache.fop.fo.flow.ListItemBody; import org.apache.fop.fo.flow.ListItemLabel; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.layoutmgr.BlockLayoutManager; import org.apache.fop.layoutmgr.BreakElement; import org.apache.fop.layoutmgr.BreakOpportunity; import org.apache.fop.layoutmgr.BreakOpportunityHelper; @@ -447,7 +448,13 @@ public class ListItemLayoutManager extends SpacedBorderedPaddedBlockLayoutManage // add the original line where the float was but without the float now returnList.add(new KnuthBlockBox(boxHeight, footnoteList, stepPosition, false)); } - + if (originalBodyPosition != null) { + LayoutManager lm = originalBodyPosition.getLM(); + if ((lm instanceof ListBlockLayoutManager || lm instanceof BlockLayoutManager) + && getKeepWithPrevious().isAuto()) { + stepPenalty++; + } + } if (addedBoxHeight < totalHeight) { Keep keep = keepWithNextActive.compare(getKeepTogether()); int p = stepPenalty; diff --git a/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml new file mode 100644 index 000000000..ae0016f4b --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml @@ -0,0 +1,100 @@ + + + + + +

+ This test checks that blocks of texts are re-laid out after a change of the flow ipd. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + 4. + + + + + + + + + b. + + + Animals, birds or fish; + + + + + c. + + + "Motor vehicles". However, this Paragraph 4.c. does not apply to: + + + (1) + + + Portable electronic equipment that: + + + + + + + + + + + + + + + + + + + + + + +