diff options
author | Simon Steiner <ssteiner@apache.org> | 2018-03-16 11:42:38 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2018-03-16 11:42:38 +0000 |
commit | a3a3995f8b6f271e57bcd87e2a03f45da2f04c16 (patch) | |
tree | 3af7c61746215ad1d7946efd4300ebea292f6043 | |
parent | c573724688e518f4c4587b791941fc3c3a66ceb2 (diff) | |
download | xmlgraphics-fop-a3a3995f8b6f271e57bcd87e2a03f45da2f04c16.tar.gz xmlgraphics-fop-a3a3995f8b6f271e57bcd87e2a03f45da2f04c16.zip |
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
-rw-r--r-- | fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java | 9 | ||||
-rw-r--r-- | fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml | 100 |
2 files changed, 108 insertions, 1 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<testcase> + <info> + <p> + This test checks that blocks of texts are re-laid out after a change of the flow ipd. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> + <fo:layout-master-set> + <fo:simple-page-master margin-right="1in" margin-left="1in" margin-bottom="0.20in" margin-top="0.20in" page-width="8.5in" page-height="11in" master-name="PageA"> + <fo:region-body margin-right="0in" margin-left="0in" margin-bottom="0.85in" margin-top="2.5in" region-name="Body"/> + + </fo:simple-page-master> + <fo:simple-page-master margin-right="0.75in" margin-left="0.75in" margin-bottom="0.20in" margin-top="0.20in" page-width="8.5in" page-height="11in" master-name="PageB"> + <fo:region-body margin-right="0in" margin-left="0in" margin-bottom="0.85in" margin-top="0.85in" region-name="Body"/> + + </fo:simple-page-master> + <fo:page-sequence-master master-name="PageSequence"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference page-position="first" master-reference="PageA"/> + <fo:conditional-page-master-reference page-position="rest" master-reference="PageB"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + <fo:page-sequence format="1" id="TH_LastPage" initial-page-number="auto" force-page-count="auto" master-reference="PageSequence"> + + <fo:flow flow-name="Body"> + <fo:block> + + <fo:list-block font-size="50pt"> + <fo:list-item space-after="5px"> + <fo:list-item-label> + <fo:block>4.</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block> + + <fo:list-block> + + <fo:list-item space-after="5px"> + <fo:list-item-label> + <fo:block>b.</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Animals, birds or fish; </fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item space-after="5px"> + <fo:list-item-label> + <fo:block>c.</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>"Motor vehicles". However, this Paragraph 4.c. does not apply to: <fo:list-block> + <fo:list-item space-after="5px"> + <fo:list-item-label> + <fo:block>(1)</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Portable electronic equipment that:</fo:block> + </fo:list-item-body> + </fo:list-item> + + </fo:list-block> + </fo:block> + </fo:list-item-body> + </fo:list-item> + + </fo:list-block> + </fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="Paragraph" xpath="//pageViewport[2]//flow/block//word"/> + </checks> +</testcase> |