You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ss...@apache.org on 2018/03/16 11:42:38 UTC

svn commit: r1826976 - in /xmlgraphics/fop/trunk: fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml

Author: ssteiner
Date: Fri Mar 16 11:42:38 2018
New Revision: 1826976

URL: http://svn.apache.org/viewvc?rev=1826976&view=rev
Log:
FOP-2776: NoSuchElementException for list changing ipd

Added:
    xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=1826976&r1=1826975&r2=1826976&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Fri Mar 16 11:42:38 2018
@@ -36,6 +36,7 @@ import org.apache.fop.fo.flow.ListItemBo
 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 exten
                 // 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;

Added: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml?rev=1826976&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml (added)
+++ xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml Fri Mar 16 11:42:38 2018
@@ -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>

Propchange: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/flow_changing-ipd_list.xml
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org