Binary files fop-0.94-orig/file.cpio and fop-0.94-src/file.cpio differ
Binary files fop-0.94-orig/lib/clib_jiio.dll and fop-0.94-src/lib/clib_jiio.dll differ
Binary files fop-0.94-orig/lib/clib_jiio_sse2.dll and fop-0.94-src/lib/clib_jiio_sse2.dll differ
Binary files fop-0.94-orig/lib/clib_jiio_util.dll and fop-0.94-src/lib/clib_jiio_util.dll differ
Binary files fop-0.94-orig/lib/clibwrapper_jiio.jar and fop-0.94-src/lib/clibwrapper_jiio.jar differ
Binary files fop-0.94-orig/lib/jai_codec.jar and fop-0.94-src/lib/jai_codec.jar differ
Binary files fop-0.94-orig/lib/jai_core.jar and fop-0.94-src/lib/jai_core.jar differ
Binary files fop-0.94-orig/lib/jai_imageio.jar and fop-0.94-src/lib/jai_imageio.jar differ
Binary files fop-0.94-orig/lib/jimi-1.0.jar and fop-0.94-src/lib/jimi-1.0.jar differ
diff -Nru fop-0.94-orig/src/java/org/apache/fop/fo/flow/Wrapper.java fop-0.94-src/src/java/org/apache/fop/fo/flow/Wrapper.java
--- fop-0.94-orig/src/java/org/apache/fop/fo/flow/Wrapper.java	2007-07-07 02:04:25.000000000 +0200
+++ fop-0.94-src/src/java/org/apache/fop/fo/flow/Wrapper.java	2009-07-15 03:25:46.000000000 +0200
@@ -21,7 +21,9 @@
 
 // Java
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FOText;
 import org.apache.fop.fo.FObjMixed;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
@@ -61,6 +63,12 @@
                     "(#PCDATA|%inline;|%block;)");
             }
         } else if (isBlockOrInlineItem(nsURI, localName)) {
+//                try {
+                    //delegate validation to parent
+//                    FONode.validateChildNode(loc, nsURI, localName);
+//                } catch (ValidationException vex) {
+//                    invalidChildError(loc, getName(), FO_URI, localName, "rule.wrapperInvalidChildForParent");
+//                }
             blockOrInlineItemFound = true;
         } else {
             invalidChildError(loc, nsURI, localName);
@@ -78,5 +86,28 @@
     public int getNameId() {
         return FO_WRAPPER;
     }
+
+    protected void addChildNode(FONode child) throws FOPException {
+        super.addChildNode(child);
+        /* If the child is a text node, and it generates areas
+         * (i.e. contains either non-white-space or preserved
+         * white-space), then check whether the nearest non-wrapper
+         * ancestor allows this.
+         */
+        if (child instanceof FOText
+                && ((FOText)child).willCreateArea()) {
+            FONode ancestor = parent;
+            while (ancestor.getNameId() == Constants.FO_WRAPPER) {
+                ancestor = ancestor.getParent();
+            }
+            if (!(ancestor instanceof FObjMixed)) {
+                invalidChildError(
+                        getLocator(),
+			FONode.FO_URI,
+                        getLocalName(),
+                        "rule.wrapperInvalidChildForParent");
+            }
+	}
+    }
 }
 
diff -Nru fop-0.94-orig/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java fop-0.94-src/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
--- fop-0.94-orig/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java	2007-04-03 21:40:14.000000000 +0200
+++ fop-0.94-src/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java	2009-07-15 04:09:21.000000000 +0200
@@ -65,6 +65,7 @@
     
     // When viewport should grow with the content.
     private boolean autoHeight = true; 
+    private boolean inlineElementList = false;
     
     /* holds the (one-time use) fo:block space-before
     and -after properties.  Large fo:blocks are split
@@ -205,6 +206,10 @@
             //(i.e., it depends on content's blockprogression-dimension)" (XSL 1.0, 7.14.1)
             allocBPD = maxbpd;
             autoHeight = true;
+            if (getBlockContainerFO().getReferenceOrientation() == 0) {
+                //Cannot easily inline element list when ref-or="180" 
+                inlineElementList = true;
+            }
         } else {
             allocBPD = height.getValue(this); //this is the content-height
             allocBPD += getBPIndents();
@@ -267,13 +272,22 @@
         addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
         firstVisibleMarkServed = true;
 
-        if (autoHeight) {
+        if (autoHeight && inlineElementList) {
             //Spaces, border and padding to be repeated at each break
             addPendingMarks(context);
 
+	    LayoutManager tmpLM;
             BlockLevelLayoutManager curLM; // currently active LM
             BlockLevelLayoutManager prevLM = null; // previously active LM
-            while ((curLM = (BlockLevelLayoutManager) getChildLM()) != null) {
+            while ((tmpLM = (LayoutManager) getChildLM()) != null) {
+		if (!(tmpLM instanceof BlockLevelLayoutManager)) {
+	                log.error("area of type: "+ tmpLM.getClass().getName() + " not allowed under flow - ignoring");
+        	        tmpLM.setFinished(true);
+                	continue;
+	        }
+
+		curLM = (BlockLevelLayoutManager)tmpLM;
+
                 LayoutContext childLC = new LayoutContext(0);
                 childLC.copyPendingMarksFrom(context);
                 // curLM is a ?
diff -Nru fop-0.94-orig/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java fop-0.94-src/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
--- fop-0.94-orig/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java	2006-11-24 18:32:48.000000000 +0100
+++ fop-0.94-src/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java	2009-07-15 03:19:14.000000000 +0200
@@ -1449,17 +1449,37 @@
     protected void wrapPositionElements(List sourceList, List targetList, boolean force) {
           
         ListIterator listIter = sourceList.listIterator();
+	Object tempElement;
+
         while (listIter.hasNext()) {
-            ListElement tempElement;
-            tempElement = (ListElement) listIter.next();
-            if (force || tempElement.getLayoutManager() != this) {
-                tempElement.setPosition(notifyPos(new NonLeafPosition(this,
-                        tempElement.getPosition())));
+            tempElement = listIter.next();
+            if (tempElement instanceof ListElement) {
+                wrapPositionElement(
+                        (ListElement) tempElement,
+                        targetList,
+                        force);
+            } else if (tempElement instanceof List) {
+                wrapPositionElements(
+                        (List) tempElement, 
+                        targetList,
+                        force);
             }
-            targetList.add(tempElement);
-        }
+	}
     }
 
+	/**
+	 * "wrap" the Position inside the given element and add it to the target list.
+	 * @param el the list element
+	 * @param targetList target list receiving the wrapped position elements
+	 * @param force if true, every Position is wrapped regardless of its LM of origin
+	 */
+	protected void wrapPositionElement(ListElement el, List targetList, boolean force) {
+		if (force || el.getLayoutManager() != this) {
+			el.setPosition(notifyPos(new NonLeafPosition(this, el.getPosition())));
+		}
+		targetList.add(el);
+	} 
+
     /** @return the sum of start-indent and end-indent */
     protected int getIPIndents() {
         return startIndent + endIndent;
diff -Nru fop-0.94-orig/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java fop-0.94-src/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
--- fop-0.94-orig/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java	2007-01-22 23:33:42.000000000 +0100
+++ fop-0.94-src/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java	2009-07-15 03:24:44.000000000 +0200
@@ -23,6 +23,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.fop.fo.pagination.Flow;
 import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
+import org.apache.fop.layoutmgr.inline.WrapperLayoutManager;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.BlockParent;
 
@@ -74,7 +75,9 @@
         LinkedList returnList = new LinkedList();
 
         while ((curLM = getChildLM()) != null) {
-            if (curLM instanceof InlineLevelLayoutManager) {
+//            if (curLM instanceof InlineLevelLayoutManager) {
+            if (!(curLM instanceof WrapperLayoutManager)
+                && curLM instanceof InlineLevelLayoutManager) {
                 log.error("inline area not allowed under flow - ignoring");
                 curLM.setFinished(true);
                 continue;
diff -Nru fop-0.94-orig/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java fop-0.94-src/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
--- fop-0.94-orig/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java	2007-08-08 19:37:33.000000000 +0200
+++ fop-0.94-src/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java	2009-07-14 22:17:45.000000000 +0200
@@ -804,31 +804,35 @@
         ListIterator oldListIterator = oldList.listIterator();
         KnuthElement el = (KnuthElement)oldListIterator.next();
         LeafPosition pos = (LeafPosition) ((KnuthBox) el).getPosition();
-        AreaInfo ai = (AreaInfo) vecAreaInfo.get(pos.getLeafPos());
-        ai.iLScount++;
-        ai.ipdArea.add(letterSpaceIPD);
-        if (BREAK_CHARS.indexOf(textArray[iTempStart - 1]) >= 0) {
-            // the last character could be used as a line break
-            // append new elements to oldList
-            oldListIterator = oldList.listIterator(oldList.size());
-            oldListIterator.add(new KnuthPenalty(0, KnuthPenalty.FLAGGED_PENALTY, true,
-                                                 new LeafPosition(this, -1), false));
-            oldListIterator.add(new KnuthGlue(letterSpaceIPD.opt,
-                                       letterSpaceIPD.max - letterSpaceIPD.opt,
-                                       letterSpaceIPD.opt - letterSpaceIPD.min,
-                                       new LeafPosition(this, -1), false));
-        } else if (letterSpaceIPD.min == letterSpaceIPD.max) {
-            // constant letter space: replace the box
-            oldListIterator.set(new KnuthInlineBox(ai.ipdArea.opt, alignmentContext, pos, false));
-        } else {
-            // adjustable letter space: replace the glue
-            oldListIterator.next(); // this would return the penalty element
-            oldListIterator.next(); // this would return the glue element
-            oldListIterator.set(new KnuthGlue(ai.iLScount * letterSpaceIPD.opt,
-                                              ai.iLScount * (letterSpaceIPD.max - letterSpaceIPD.opt),
-                                              ai.iLScount * (letterSpaceIPD.opt - letterSpaceIPD.min),
-                                              new LeafPosition(this, -1), true));
-        }
+       	int idx = pos.getLeafPos(); 
+	//element could refer to '-1' position, for non-collapsed spaces (?) 
+	if (idx >= -1) { 
+		AreaInfo ai = (AreaInfo) vecAreaInfo.get(idx);
+	        ai.iLScount++;
+	        ai.ipdArea.add(letterSpaceIPD);
+	        if (BREAK_CHARS.indexOf(textArray[iTempStart - 1]) >= 0) {
+	            // the last character could be used as a line break
+	            // append new elements to oldList
+	            oldListIterator = oldList.listIterator(oldList.size());
+	            oldListIterator.add(new KnuthPenalty(0, KnuthPenalty.FLAGGED_PENALTY, true,
+	                                                 new LeafPosition(this, -1), false));
+	            oldListIterator.add(new KnuthGlue(letterSpaceIPD.opt,
+	                                       letterSpaceIPD.max - letterSpaceIPD.opt,
+	                                       letterSpaceIPD.opt - letterSpaceIPD.min,
+	                                       new LeafPosition(this, -1), false));
+	        } else if (letterSpaceIPD.min == letterSpaceIPD.max) {
+	            // constant letter space: replace the box
+	            oldListIterator.set(new KnuthInlineBox(ai.ipdArea.opt, alignmentContext, pos, false));
+	        } else {
+	            // adjustable letter space: replace the glue
+	            oldListIterator.next(); // this would return the penalty element
+	            oldListIterator.next(); // this would return the glue element
+	            oldListIterator.set(new KnuthGlue(ai.iLScount * letterSpaceIPD.opt,
+	                                              ai.iLScount * (letterSpaceIPD.max - letterSpaceIPD.opt),
+	                                              ai.iLScount * (letterSpaceIPD.opt - letterSpaceIPD.min),
+	                                              new LeafPosition(this, -1), true));
+	        }
+	}
         return oldList;
     }
 
diff -Nru fop-0.94-orig/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java fop-0.94-src/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java
--- fop-0.94-orig/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java	2007-05-07 14:22:22.000000000 +0200
+++ fop-0.94-src/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java	2009-07-15 03:10:37.000000000 +0200
@@ -20,7 +20,12 @@
 package org.apache.fop.layoutmgr.inline;
 
 import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.area.inline.InlineParent;
+import org.apache.fop.area.Block;
+import org.apache.fop.area.LineArea;
 import org.apache.fop.fo.flow.Wrapper;
+import org.apache.fop.layoutmgr.BlockLayoutManager;
+import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.PositionIterator;
 import org.apache.fop.layoutmgr.TraitSetter;
@@ -68,7 +73,20 @@
         if (id != null && id.length() > 0) {
             addId();
             InlineArea area = getEffectiveArea();
-            parentLM.addChildArea(area);
+//            parentLM.addChildArea(area);
+            if (parentLM instanceof BlockStackingLayoutManager
+                    && !(parentLM instanceof BlockLayoutManager)) {
+                Block helperBlock = new Block();
+                LineArea helperLine = new LineArea();
+                InlineParent helperInline = new InlineParent();
+                helperInline.addChildArea(area);
+                helperLine.addInlineArea(helperInline);
+                helperLine.updateExtentsFromChildren();
+                helperBlock.addLineArea(helperLine);
+                parentLM.addChildArea(helperBlock);
+            } else {
+                parentLM.addChildArea(area);
+            }
         }
         while (posIter.hasNext()) {
             posIter.next();
diff -Nru fop-0.94-orig/test/layoutengine/disabled-testcases.xml fop-0.94-src/test/layoutengine/disabled-testcases.xml
--- fop-0.94-orig/test/layoutengine/disabled-testcases.xml	2007-08-08 19:37:33.000000000 +0200
+++ fop-0.94-src/test/layoutengine/disabled-testcases.xml	2009-07-15 03:10:48.000000000 +0200
@@ -300,12 +300,12 @@
     is probably not expressing the indended outcome according to the spec. The test
     case should be revisited.</description>
   </testcase>
-  <testcase>
+  <!-- testcase>
     <name>fo:wrapper around block-level content (with id)</name>
     <file>wrapper_block_id.xml</file>
     <description>"id" attributes on fo:wrapper around block-level content don't get
     added to the area tree.</description>
-  </testcase>
+  </testcase -->
   <testcase>
     <name>Bugzilla #40230: invalid extra page break</name>
     <file>block_break-after_bug40230.xml</file>
