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 je...@apache.org on 2011/06/21 11:44:42 UTC

svn commit: r1137921 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java test/layoutengine/standard-testcases/inline_empty.xml

Author: jeremias
Date: Tue Jun 21 09:44:42 2011
New Revision: 1137921

URL: http://svn.apache.org/viewvc?rev=1137921&view=rev
Log:
Fixed regression introduced by SVN rev 1088079:
Endless loop with empty fo:inline.

Added:
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_empty.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=1137921&r1=1137920&r2=1137921&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Tue Jun 21 09:44:42 2011
@@ -649,8 +649,8 @@ public class LineLayoutManager extends I
 
         Paragraph lastPar = null;
 
-        InlineLevelLayoutManager curLM = (InlineLevelLayoutManager) getChildLM();
-        while (curLM != null) {
+        InlineLevelLayoutManager curLM;
+        while ((curLM = (InlineLevelLayoutManager) getChildLM()) != null) {
             List inlineElements = curLM.getNextKnuthElements(inlineLC, effectiveAlignment);
             if (inlineElements == null || inlineElements.size() == 0) {
                 /* curLM.getNextKnuthElements() returned null or an empty list;
@@ -747,7 +747,6 @@ public class LineLayoutManager extends I
                     }
                 }
             } // end of loop over returnedList
-            curLM = (InlineLevelLayoutManager) getChildLM();
         }
 
         if (lastPar != null) {
@@ -1149,6 +1148,7 @@ public class LineLayoutManager extends I
     }
 
     /** {@inheritDoc} */
+    @Override
     public List getChangedKnuthElements(List oldList, int alignment) {
         List<KnuthElement> returnList = new LinkedList<KnuthElement>();
         for (int p = 0; p < knuthParagraphs.size(); p++) {
@@ -1419,7 +1419,7 @@ public class LineLayoutManager extends I
     private void addInlineArea(LayoutContext context, LineBreakPosition lbp,
             boolean isLastPosition) {
 
-        KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(lbp.parIndex);
+        KnuthSequence seq = knuthParagraphs.get(lbp.parIndex);
         int startElementIndex = lbp.startIndex;
         int endElementIndex = lbp.getLeafPos();
 

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_empty.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_empty.xml?rev=1137921&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_empty.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_empty.xml Tue Jun 21 09:44:42 2011
@@ -0,0 +1,46 @@
+<?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 an empty fo:inline. This used to create an endless loop
+      so we're checking that here so it doesn't happen again.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal" white-space-collapse="true">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>No endless loop, please: <fo:inline/></fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <element-list category="breaker">
+      <box w="14400"/>
+      <skip>3</skip>
+    </element-list>
+  </checks>
+</testcase>

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

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_empty.xml
------------------------------------------------------------------------------
    svn:keywords = Id



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