Browse Source

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
pull/6/head
Simon Steiner 6 years ago
parent
commit
45276e0098

+ 8
- 1
fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java View File

@@ -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;

+ 100
- 0
fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml View File

@@ -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>

Loading…
Cancel
Save