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 vh...@apache.org on 2009/06/26 19:10:26 UTC

svn commit: r788768 - in /xmlgraphics/fop/branches/Temp_ChangingIPDHack: src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/layoutmgr/inline/ test/layoutengine/standard-testcases/

Author: vhennebert
Date: Fri Jun 26 17:10:26 2009
New Revision: 788768

URL: http://svn.apache.org/viewvc?rev=788768&view=rev
Log:
First very rough implementation of Changing IPD. It works only with (possibly nested) fo:block elements containing pure text. Doesn't work if the page break occurs /between/ two fo:block. There's a problem with elastic spaces that get lost after the ipd change. There is duplicated code especially in BlockStackingLayoutManager. Plus probably plenty of other issues...

Added:
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_1.xml   (with props)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_2.xml   (with props)
Modified:
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LeafPosition.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageProvider.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/Position.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Fri Jun 26 17:10:26 2009
@@ -27,6 +27,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.fop.fo.Constants;
+import org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.util.ListUtil;
 
@@ -214,6 +215,11 @@
      */
     protected abstract List getNextKnuthElements(LayoutContext context, int alignment);
 
+    protected List getNextKnuthElements(LayoutContext context, int alignment,
+            KnuthElement elementAtIPDChange) {
+        throw new UnsupportedOperationException("TODO: implement acceptable fallback");
+    }
+
     /** @return true if there's no content that could be handled. */
     public boolean isEmpty() {
         return (this.blockLists.isEmpty());
@@ -316,7 +322,6 @@
                         getPageProvider(), createLayoutListener(),
                         alignment, alignmentLast, footnoteSeparatorLength,
                         isPartOverflowRecoveryActivated(), autoHeight, isSinglePartFavored());
-                int iOptPageCount;
 
                 BlockSequence effectiveList;
                 if (getCurrentDisplayAlign() == Constants.EN_X_FILL) {
@@ -327,16 +332,28 @@
                     effectiveList = blockList;
                 }
 
-                //iOptPageCount = alg.firstFit(effectiveList, flowBPD, 1, true);
                 alg.setConstantLineWidth(flowBPD);
-                iOptPageCount = alg.findBreakingPoints(effectiveList, /*flowBPD,*/
-                            1, true, BreakingAlgorithm.ALL_BREAKS);
-                log.debug("PLM> iOptPageCount= " + iOptPageCount
-                        + " pageBreaks.size()= " + alg.getPageBreaks().size());
+                int optimalPageCount = alg.findBreakingPoints(effectiveList, 1, true,
+                        BreakingAlgorithm.ALL_BREAKS);
+                if (alg.ipdChanged()) {
+                    KnuthNode optimalBreak = alg.getBestNodeBeforeIPDChange();
+                    KnuthElement elementAtBreak = alg.getElement(optimalBreak.position);
+                    log.trace("IPD changes after page " + optimalPageCount + " at index "
+                            + optimalBreak.position);
+                    doPhase3(alg, optimalPageCount, blockList, effectiveList);
+
+                    blockLists.clear();
+                    blockListIndex = -1;
+                    nextSequenceStartsOn = getNextBlockList(childLC, Constants.EN_COLUMN,
+                            elementAtBreak);
+                } else {
+                    log.debug("PLM> iOptPageCount= " + optimalPageCount
+                            + " pageBreaks.size()= " + alg.getPageBreaks().size());
 
 
-                //*** Phase 3: Add areas ***
-                doPhase3(alg, iOptPageCount, blockList, effectiveList);
+                    //*** Phase 3: Add areas ***
+                    doPhase3(alg, optimalPageCount, blockList, effectiveList);
+                }
             }
         }
 
@@ -529,6 +546,7 @@
     protected int handleSpanChange(LayoutContext childLC, int nextSequenceStartsOn) {
         return nextSequenceStartsOn;
     }
+
     /**
      * Gets the next block list (sequence) and adds it to a list of block lists if it's not empty.
      * @param childLC LayoutContext to use
@@ -537,12 +555,29 @@
      */
     protected int getNextBlockList(LayoutContext childLC,
             int nextSequenceStartsOn) {
+        return getNextBlockList(childLC, nextSequenceStartsOn, null);
+    }
+
+    /**
+     * Gets the next block list (sequence) and adds it to a list of block lists if it's not empty.
+     * @param childLC LayoutContext to use
+     * @param nextSequenceStartsOn indicates on what page the next sequence should start
+     * @param elementAtIPDChange last element on the part before an IPD change
+     * @return the page on which the next content should appear after a hard break
+     */
+    protected int getNextBlockList(LayoutContext childLC,
+            int nextSequenceStartsOn, KnuthElement elementAtIPDChange) {
         updateLayoutContext(childLC);
         //Make sure the span change signal is reset
         childLC.signalSpanChange(Constants.NOT_SET);
 
         BlockSequence blockList;
-        List returnedList = getNextKnuthElements(childLC, alignment);
+        List returnedList;
+        if (elementAtIPDChange == null) {
+            returnedList = getNextKnuthElements(childLC, alignment);
+        } else {
+            returnedList = getNextKnuthElements(childLC, alignment, elementAtIPDChange);
+        }
         if (returnedList != null) {
             if (returnedList.isEmpty()) {
                 nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Fri Jun 26 17:10:26 2009
@@ -122,6 +122,21 @@
         return null;
     }
 
+    protected void setCurrentChildLM(LayoutManager childLM) {
+        curChildLM = childLM;
+        childLMiter = new LMiter(this);
+        do {
+            curChildLM = (LayoutManager) childLMiter.next();
+        } while (curChildLM != childLM);
+    }
+
+    protected void resetChildLMs() {
+        curChildLM = null;
+        while (childLMiter.hasPrevious()) {
+            childLMiter.previous();
+        }
+    }
+
     /**
      * Return indication if getChildLM will return another LM.
      * @return true if another child LM is still available

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Fri Jun 26 17:10:26 2009
@@ -22,6 +22,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Stack;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -111,8 +112,17 @@
 
     /** {@inheritDoc} */
     public List getNextKnuthElements(LayoutContext context, int alignment) {
+        return getNextKnuthElements(context, alignment, null, null);
+    }
+
+    List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
+            LeafPosition restartPosition) {
         resetSpaces();
-        return super.getNextKnuthElements(context, alignment);
+        if (lmStack == null) {
+            return super.getNextKnuthElements(context, alignment);
+        } else {
+            return super.getNextKnuthElements(context, alignment, lmStack, restartPosition);
+        }
     }
 
     private void resetSpaces() {

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Fri Jun 26 17:10:26 2009
@@ -23,6 +23,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Stack;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -361,8 +362,188 @@
         return elements;
     }
 
+    /** {@inheritDoc} */
+    List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, LeafPosition position) {
+        referenceIPD = context.getRefIPD();
+        updateContentAreaIPDwithOverconstrainedAdjust();
+
+        List contentList = new LinkedList();
+        List elements = new LinkedList();
+
+        if (!breakBeforeServed) {
+            breakBeforeServed = true;
+            if (!context.suppressBreakBefore()) {
+                if (addKnuthElementsForBreakBefore(elements, context)) {
+                    return elements;
+                }
+            }
+        }
+
+        if (!firstVisibleMarkServed) {
+            addKnuthElementsForSpaceBefore(elements, alignment);
+            context.updateKeepWithPreviousPending(getKeepWithPreviousStrength());
+        }
+
+        addKnuthElementsForBorderPaddingBefore(elements, !firstVisibleMarkServed);
+        firstVisibleMarkServed = true;
+
+        //Spaces, border and padding to be repeated at each break
+        addPendingMarks(context);
+
+        //Used to indicate a special break-after case when all content has already been generated.
+        BreakElement forcedBreakAfterLast = null;
+
+        LayoutManager currentChildLM = (BlockLevelLayoutManager) lmStack.pop();
+        setCurrentChildLM(currentChildLM);
+        LayoutContext childLC = new LayoutContext(0);
+        List childrenElements = getNextChildElements(currentChildLM, context, childLC, alignment,
+                lmStack, position);
+
+        if (contentList.isEmpty()) {
+            //Propagate keep-with-previous up from the first child
+            context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
+        }
+        if (childrenElements != null && !childrenElements.isEmpty()) {
+            if (!contentList.isEmpty()
+                    && !ElementListUtils.startsWithForcedBreak(childrenElements)) {
+                // there is a block handled by prevLM before the one
+                // handled by curLM, and the one handled
+                // by the current LM does not begin with a break
+                addInBetweenBreak(contentList, context, childLC);
+            }
+            if (childrenElements.size() == 1
+                    && ElementListUtils.startsWithForcedBreak(childrenElements)) {
+
+                if (currentChildLM.isFinished() && !hasNextChildLM()) {
+                    // a descendant of this block has break-before
+                    forcedBreakAfterLast = (BreakElement) childrenElements.get(0);
+                    context.clearPendingMarks();
+//                    break; TODO
+                }
+
+                if (contentList.isEmpty()) {
+                    // Empty fo:block, zero-length box makes sure the IDs and/or markers
+                    // are registered and borders/padding are painted.
+                    elements.add(new KnuthBox(0, notifyPos(new Position(this)), false));
+                }
+                // a descendant of this block has break-before
+                contentList.addAll(childrenElements);
+
+                wrapPositionElements(contentList, elements);
+
+                return elements;
+            } else {
+                contentList.addAll(childrenElements);
+                if (ElementListUtils.endsWithForcedBreak(childrenElements)) {
+                    // a descendant of this block has break-after
+                    if (currentChildLM.isFinished() && !hasNextChildLM()) {
+                        forcedBreakAfterLast = (BreakElement) ListUtil.removeLast(contentList);
+                        context.clearPendingMarks();
+//                        break; TODO
+                    }
+
+                    wrapPositionElements(contentList, elements);
+
+                    return elements;
+                }
+            }
+            context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
+        }
+
+        while ((currentChildLM = (LayoutManager) getChildLM()) != null) {
+            ((AbstractLayoutManager) currentChildLM).resetChildLMs(); // TODO won't work with forced breaks
+
+            childLC = new LayoutContext(0);
+
+            childrenElements = getNextChildElements(currentChildLM, context, childLC,
+                    alignment);
+
+            if (contentList.isEmpty()) {
+                //Propagate keep-with-previous up from the first child
+                context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
+            }
+            if (childrenElements != null && !childrenElements.isEmpty()) {
+                if (!contentList.isEmpty()
+                        && !ElementListUtils.startsWithForcedBreak(childrenElements)) {
+                    // there is a block handled by prevLM before the one
+                    // handled by curLM, and the one handled
+                    // by the current LM does not begin with a break
+                    addInBetweenBreak(contentList, context, childLC);
+                }
+                if (childrenElements.size() == 1
+                        && ElementListUtils.startsWithForcedBreak(childrenElements)) {
+
+                    if (currentChildLM.isFinished() && !hasNextChildLM()) {
+                        // a descendant of this block has break-before
+                        forcedBreakAfterLast = (BreakElement) childrenElements.get(0);
+                        context.clearPendingMarks();
+                        break;
+                    }
+
+                    if (contentList.isEmpty()) {
+                        // Empty fo:block, zero-length box makes sure the IDs and/or markers
+                        // are registered and borders/padding are painted.
+                        elements.add(new KnuthBox(0, notifyPos(new Position(this)), false));
+                    }
+                    // a descendant of this block has break-before
+                    contentList.addAll(childrenElements);
+
+                    wrapPositionElements(contentList, elements);
+
+                    return elements;
+                } else {
+                    contentList.addAll(childrenElements);
+                    if (ElementListUtils.endsWithForcedBreak(childrenElements)) {
+                        // a descendant of this block has break-after
+                        if (currentChildLM.isFinished() && !hasNextChildLM()) {
+                            forcedBreakAfterLast = (BreakElement) ListUtil.removeLast(contentList);
+                            context.clearPendingMarks();
+                            break;
+                        }
+
+                        wrapPositionElements(contentList, elements);
+
+                        return elements;
+                    }
+                }
+                context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
+            }
+        }
+
+        if (!contentList.isEmpty()) {
+            wrapPositionElements(contentList, elements);
+        } else if (forcedBreakAfterLast == null) {
+            // Empty fo:block, zero-length box makes sure the IDs and/or markers
+            // are registered.
+            elements.add(new KnuthBox(0, notifyPos(new Position(this)), true));
+        }
+
+        addKnuthElementsForBorderPaddingAfter(elements, true);
+        addKnuthElementsForSpaceAfter(elements, alignment);
+
+        //All child content is processed. Only break-after can occur now, so...
+        context.clearPendingMarks();
+        if (forcedBreakAfterLast == null) {
+            addKnuthElementsForBreakAfter(elements, context);
+        } else {
+            forcedBreakAfterLast.clearPendingMarks();
+            elements.add(forcedBreakAfterLast);
+        }
+
+        context.updateKeepWithNextPending(getKeepWithNextStrength());
+
+        setFinished(true);
+
+        return elements;
+    }
+
     private List getNextChildElements(LayoutManager childLM, LayoutContext context,
             LayoutContext childLC, int alignment) {
+        return getNextChildElements(childLM, context, childLC, alignment, null, null);
+    }
+
+    private List getNextChildElements(LayoutManager childLM, LayoutContext context,
+            LayoutContext childLC, int alignment, Stack lmStack, LeafPosition restartPosition) {
         childLC.copyPendingMarksFrom(context);
         childLC.setStackLimitBP(context.getStackLimitBP());
         if (childLM instanceof LineLayoutManager) {
@@ -375,7 +556,19 @@
             //Handled already by the parent (break collapsing, see above)
         }
 
-        return childLM.getNextKnuthElements(childLC, alignment);
+        if (lmStack == null) {
+            return childLM.getNextKnuthElements(childLC, alignment);
+        } else {
+            if (childLM instanceof LineLayoutManager) {
+                return ((LineLayoutManager) childLM).getNextKnuthElements(childLC, alignment,
+                        restartPosition);
+            } else if (childLM instanceof BlockLayoutManager) {
+                return ((BlockLayoutManager) childLM).getNextKnuthElements(childLC, alignment,
+                        lmStack, restartPosition);
+            } else {
+                throw new UnsupportedOperationException("TODO: layout manager not restartable");
+            }
+        }
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Fri Jun 26 17:10:26 2009
@@ -487,6 +487,9 @@
                 previousIsBox = false;
             }
             if (activeNodeCount == 0) {
+                if (ipdChanged()) {
+                    return handleIpdChange();
+                }
                 if (!force) {
                     log.debug("Could not find a set of breaking points " + threshold);
                     return 0;
@@ -571,6 +574,14 @@
         return line;
     }
 
+    protected boolean ipdChanged() {
+        return false;
+    }
+
+    protected int handleIpdChange() {
+        throw new IllegalStateException();
+    }
+
     /**
      * This method tries to find the context FO for a position in a KnuthSequence.
      * @param seq the KnuthSequence to inspect
@@ -1117,7 +1128,7 @@
      * @param par the corresponding paragraph
      * @param total the number of lines into which the paragraph will be broken
      */
-    private void calculateBreakPoints(KnuthNode node, KnuthSequence par,
+    protected void calculateBreakPoints(KnuthNode node, KnuthSequence par,
                                       int total) {
         KnuthNode bestActiveNode = node;
         // use bestActiveNode to determine the optimum breakpoints

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Fri Jun 26 17:10:26 2009
@@ -22,6 +22,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Stack;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -66,31 +67,52 @@
 
         LayoutManager currentChildLM;
         while ((currentChildLM = getChildLM()) != null) {
-            if (handleSpanChange(currentChildLM, elements, context)) {
-                SpaceResolver.resolveElementList(elements);
+            if (addChildElements(elements, currentChildLM, context, alignment) != null) {
                 return elements;
             }
+        }
 
-            LayoutContext childLC = new LayoutContext(0);
-            List childrenElements = getNextChildElements(currentChildLM, context, childLC,
-                    alignment);
-            if (elements.isEmpty()) {
-                context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
-            }
-            if (!elements.isEmpty()
-                    && !ElementListUtils.startsWithForcedBreak(childrenElements)) {
-                addInBetweenBreak(elements, context, childLC);
-            }
-            context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
+        SpaceResolver.resolveElementList(elements);
+        setFinished(true);
 
-            elements.addAll(childrenElements);
+        assert !elements.isEmpty();
+        return elements;
+    }
 
-            if (ElementListUtils.endsWithForcedBreak(elements)) {
-                // a descendant of this flow has break-before or break-after
-                if (currentChildLM.isFinished() && !hasNextChildLM()) {
-                    setFinished(true);
-                }
-                SpaceResolver.resolveElementList(elements);
+    /** {@inheritDoc} */
+    public List getNextKnuthElements(LayoutContext context, int alignment,
+            KnuthElement elementAtIPDChange) {
+
+        List elements = new LinkedList();
+
+        LayoutManager currentChildLM = null;
+
+        Position position = elementAtIPDChange.getPosition();
+        while (position != null && (currentChildLM = position.getLM()) == null) {
+            position = position.getPosition();
+        }
+        if (currentChildLM == null) {
+            throw new IllegalStateException(
+                    "Cannot find layout manager from where to re-start layout after IPD change");
+        }
+        Stack lmStack = new Stack();
+        while (currentChildLM.getParent() != this) {
+            lmStack.push(currentChildLM);
+            currentChildLM = currentChildLM.getParent();
+        }
+        setCurrentChildLM(currentChildLM);
+        if (!(currentChildLM instanceof BlockLayoutManager)) {
+            throw new UnsupportedOperationException("TODO: layout manager not restartable");
+        } else {
+            if (addChildElements(elements, currentChildLM, context, alignment, lmStack,
+                    (LeafPosition) position) != null) {
+                return elements;
+            }
+        }
+
+        while ((currentChildLM = getChildLM()) != null) {
+            ((AbstractLayoutManager) currentChildLM).resetChildLMs(); // TODO won't work with forced breaks
+            if (addChildElements(elements, currentChildLM, context, alignment) != null) {
                 return elements;
             }
         }
@@ -102,6 +124,43 @@
         return elements;
     }
 
+    private List addChildElements(List elements, LayoutManager childLM, LayoutContext context,
+            int alignment) {
+        return addChildElements(elements, childLM, context, alignment, null, null);
+    }
+
+    private List addChildElements(List elements, LayoutManager childLM, LayoutContext context,
+            int alignment, Stack lmStack, LeafPosition position) {
+        if (handleSpanChange(childLM, elements, context)) {
+            SpaceResolver.resolveElementList(elements);
+            return elements;
+        }
+
+        LayoutContext childLC = new LayoutContext(0);
+        List childrenElements = getNextChildElements(childLM, context, childLC,
+                alignment, lmStack, position);
+        if (elements.isEmpty()) {
+            context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
+        }
+        if (!elements.isEmpty()
+                && !ElementListUtils.startsWithForcedBreak(childrenElements)) {
+            addInBetweenBreak(elements, context, childLC);
+        }
+        context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
+
+        elements.addAll(childrenElements);
+
+        if (ElementListUtils.endsWithForcedBreak(elements)) {
+            // a descendant of this flow has break-before or break-after
+            if (childLM.isFinished() && !hasNextChildLM()) {
+                setFinished(true);
+            }
+            SpaceResolver.resolveElementList(elements);
+            return elements;
+        }
+        return null;
+    }
+
     private boolean handleSpanChange(LayoutManager childLM, List elements, LayoutContext context) {
         int span = EN_NONE;
         int disableColumnBalancing = EN_FALSE;
@@ -129,13 +188,18 @@
     }
 
     private List getNextChildElements(LayoutManager childLM, LayoutContext context,
-            LayoutContext childLC, int alignment) {
+            LayoutContext childLC, int alignment, Stack lmStack, LeafPosition restartPosition) {
         childLC.setStackLimitBP(context.getStackLimitBP());
         childLC.setRefIPD(context.getRefIPD());
         childLC.setWritingMode(getCurrentPage().getSimplePageMaster().getWritingMode());
 
-        // get elements from curLM
-        List childrenElements = childLM.getNextKnuthElements(childLC, alignment);
+        List childrenElements;
+        if (lmStack == null) {
+            childrenElements = childLM.getNextKnuthElements(childLC, alignment);
+        } else {
+            childrenElements = ((BlockLayoutManager) childLM).getNextKnuthElements(childLC,
+                    alignment, lmStack, restartPosition);
+        }
         assert !childrenElements.isEmpty();
 
         // "wrap" the Position inside each element

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LeafPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LeafPosition.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LeafPosition.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LeafPosition.java Fri Jun 26 17:10:26 2009
@@ -28,6 +28,11 @@
         leafPos = pos;
     }
 
+    public LeafPosition(LayoutManager layoutManager, int pos, int index) {
+        super(layoutManager, index);
+        leafPos = pos;
+    }
+
     public int getLeafPos() {
         return leafPos;
     }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java Fri Jun 26 17:10:26 2009
@@ -129,6 +129,12 @@
     /** {@inheritDoc} */
     protected int getNextBlockList(LayoutContext childLC,
             int nextSequenceStartsOn) {
+        return getNextBlockList(childLC, nextSequenceStartsOn, null);
+    }
+
+    /** {@inheritDoc} */
+    protected int getNextBlockList(LayoutContext childLC, int nextSequenceStartsOn,
+            KnuthElement elementAtIPDChange) {
         if (!firstPart) {
             // if this is the first page that will be created by
             // the current BlockSequence, it could have a break
@@ -140,7 +146,7 @@
         pageBreakHandled = true;
         pageProvider.setStartOfNextElementList(pslm.getCurrentPageNum(),
                 pslm.getCurrentPV().getCurrentSpan().getCurrentFlowIndex());
-        return super.getNextBlockList(childLC, nextSequenceStartsOn);
+        return super.getNextBlockList(childLC, nextSequenceStartsOn, elementAtIPDChange);
     }
 
     private boolean containsFootnotes(List contentList, LayoutContext context) {
@@ -217,6 +223,22 @@
         return contentList;
     }
 
+    protected List getNextKnuthElements(LayoutContext context, int alignment,
+            KnuthElement elementAtIPDChange) {
+        List contentList = null;
+
+        do {
+            contentList = childFLM.getNextKnuthElements(context, alignment, elementAtIPDChange);
+        } while (!childFLM.isFinished() && contentList == null);
+
+        // scan contentList, searching for footnotes
+        if (containsFootnotes(contentList, context)) {
+            // handle the footnote separator
+            handleFootnoteSeparator();
+        }
+        return contentList;
+    }
+
     /**
      * @return current display alignment
      */

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Fri Jun 26 17:10:26 2009
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.layoutmgr.AbstractBreaker.PageBreakPosition;
@@ -92,6 +93,9 @@
     //Controls whether a single part should be forced if possible (ex. block-container)
     private boolean favorSinglePart = false;
 
+    private boolean ipdChange;
+    private KnuthNode bestNodeForIPDChange;
+
     public PageBreakingAlgorithm(LayoutManager topLevelLM,
                                  PageProvider pageProvider,
                                  PageBreakingLayoutListener layoutListener,
@@ -889,4 +893,49 @@
 
     }
 
+    /** {@inheritDoc} */
+    protected boolean ipdChanged() {
+        return ipdChange;
+    }
+
+    /** {@inheritDoc} */
+    protected int handleIpdChange() {
+        log.trace("Best node for ipd change:" + bestNodeForIPDChange);
+        // TODO finish()
+        calculateBreakPoints(bestNodeForIPDChange, par, bestNodeForIPDChange.line);
+        activeLines = null;
+        return bestNodeForIPDChange.line;
+    }
+
+    /**
+     * Add a node at the end of the given line's existing active nodes.
+     * If this is the first node in the line, adjust endLine accordingly.
+     * @param line number of the line ending at the node's corresponding breakpoint
+     * @param node the active node to add
+     */
+    protected void addNode(int line, KnuthNode node) {
+        if (node.position < par.size() - 1 && line > 0 && ipdChange(line - 1)) {
+            log.trace("IPD changes at page " + line);
+            ipdChange = true;
+            if (bestNodeForIPDChange == null
+                    || node.totalDemerits < bestNodeForIPDChange.totalDemerits) {
+                bestNodeForIPDChange = node;
+            }
+        } else {
+            super.addNode(line, node);
+        }
+    }
+
+    KnuthNode getBestNodeBeforeIPDChange() {
+        return bestNodeForIPDChange;
+    }
+
+    /** {@inheritDoc} */
+    protected boolean ipdChange(int line) {
+        if (pageProvider == null) {
+            return false;
+        }
+        return pageProvider.ipdChange(line);
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageProvider.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageProvider.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageProvider.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageProvider.java Fri Jun 26 17:10:26 2009
@@ -147,6 +147,33 @@
     }
 
     /**
+     * Returns true if the part following the given one has a different IPD.
+     *
+     * @param index index of the current part
+     * @return true if the following part has a different IPD, false otherwise
+     */
+    public boolean ipdChange(int index) {
+        int columnCount = 0;
+        int colIndex = startColumnOfCurrentElementList + index;
+        int pageIndex = -1;
+        Page page;
+        do {
+            colIndex -= columnCount;
+            pageIndex++;
+            page = getPage(false, pageIndex, RELTO_CURRENT_ELEMENT_LIST);
+            columnCount = page.getPageViewport().getCurrentSpan().getColumnCount();
+        } while (colIndex >= columnCount);
+        if (colIndex + 1 < columnCount) {
+            // Next part is a column on same page => same IPD
+            return false;
+        } else {
+            Page nextPage = getPage(false, pageIndex + 1, RELTO_CURRENT_ELEMENT_LIST);
+            return page.getPageViewport().getBodyRegion().getIPD()
+                    != nextPage.getPageViewport().getBodyRegion().getIPD();
+        }
+    }
+
+    /**
      * Returns the part index (0<x<partCount) which denotes the first part on the last page
      * generated by the current element list.
      * @param partCount Number of parts determined by the breaking algorithm
@@ -272,4 +299,4 @@
         return page;
     }
 
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/Position.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/Position.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/Position.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/Position.java Fri Jun 26 17:10:26 2009
@@ -28,6 +28,11 @@
         layoutManager = lm;
     }
 
+   public Position(LayoutManager lm, int index) {
+        this(lm);
+        setIndex(index);
+    }
+
     public LayoutManager getLM() {
         return layoutManager;
     }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/SpaceResolver.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/SpaceResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/SpaceResolver.java Fri Jun 26 17:10:26 2009
@@ -19,7 +19,6 @@
 
 package org.apache.fop.layoutmgr;
 
-import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 
@@ -565,6 +564,11 @@
         public Position getOriginalBreakPosition() {
             return this.originalPosition;
         }
+
+        public Position getPosition() {
+            return originalPosition;
+        }
+
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=788768&r1=788767&r2=788768&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Fri Jun 26 17:10:26 2009
@@ -20,6 +20,7 @@
 package org.apache.fop.layoutmgr.inline;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
@@ -486,13 +487,6 @@
             }
         }
 
-        public int findBreakingPoints(Paragraph par, /*int lineWidth,*/
-                                      double threshold, boolean force,
-                                      int allowedBreaks) {
-            return super.findBreakingPoints(par, /*lineWidth,*/
-                    threshold, force, allowedBreaks);
-        }
-
         protected int filterActiveNodes() {
             KnuthNode bestActiveNode = null;
 
@@ -568,8 +562,7 @@
         alignmentContext = new AlignmentContext(fs, lineHeight.getValue(this),
                 context.getWritingMode());
         context.setAlignmentContext(alignmentContext);
-        // Get a break from currently active child LM
-        // Set up constraints for inline level managers
+        ipd = context.getRefIPD();
 
         //PHASE 1: Create Knuth elements
         if (knuthParagraphs == null) {
@@ -593,6 +586,33 @@
         return createLineBreaks(context.getBPAlignment(), context);
     }
 
+    public List getNextKnuthElements(LayoutContext context, int alignment,
+            LeafPosition restartPosition) {
+        log.trace("Restarting line breaking from index " + restartPosition.getIndex());
+        int parIndex = restartPosition.getLeafPos();
+        Paragraph paragraph = (Paragraph) knuthParagraphs.get(parIndex);
+        for (int i = 0; i <= restartPosition.getIndex(); i++) {
+            paragraph.remove(0);
+        }
+        Iterator iter = paragraph.iterator();
+        while (iter.hasNext() && !((KnuthElement) iter.next()).isBox()) {
+            iter.remove();
+        }
+        if (!iter.hasNext()) {
+            knuthParagraphs.remove(parIndex);
+        }
+
+        // return finished when there's no content
+        if (knuthParagraphs.size() == 0) {
+            setFinished(true);
+            return null;
+        }
+
+        ipd = context.getRefIPD();
+        //PHASE 2: Create line breaks
+        return createLineBreaks(context.getBPAlignment(), context);
+    }
+
     /**
      * Phase 1 of Knuth algorithm: Collect all inline Knuth elements before determining line breaks.
      * @param context the LayoutContext
@@ -600,8 +620,6 @@
     private void collectInlineKnuthElements(LayoutContext context) {
         LayoutContext inlineLC = new LayoutContext(context);
 
-        ipd = context.getRefIPD();
-
         // convert all the text in a sequence of paragraphs made
         // of KnuthBox, KnuthGlue and KnuthPenalty objects
         boolean previousIsBox = false;
@@ -873,6 +891,7 @@
 
         List returnList = new LinkedList();
 
+        int endIndex = -1;
         for (int p = 0; p < knuthParagraphs.size(); p++) {
             // penalty between paragraphs
             if (p > 0) {
@@ -924,11 +943,10 @@
                         int penalty = KeepUtil.getPenaltyForKeep(strength);
                         if (penalty < KnuthElement.INFINITE) {
                             returnList.add(new BreakElement(
-                                    returnPosition, penalty, context));
+                                    new LeafPosition(this, p, endIndex), penalty, context));
                         }
                     }
-                    int endIndex
-                      = ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();
+                    endIndex = ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();
                     // create a list of the FootnoteBodyLM handling footnotes
                     // whose citations are in this line
                     List footnoteList = new LinkedList();

Added: xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_1.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_1.xml?rev=788768&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_1.xml (added)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_1.xml Fri Jun 26 17:10:26 2009
@@ -0,0 +1,86 @@
+<?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">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="narrow"
+          page-height="300pt" page-width="400pt" margin="50pt">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+        <fo:simple-page-master master-name="wide"
+          page-height="300pt" page-width="600pt" margin="50pt">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+        <fo:page-sequence-master master-name="pages">
+          <fo:single-page-master-reference master-reference="narrow"/>
+          <fo:repeatable-page-master-reference master-reference="wide"/>
+        </fo:page-sequence-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="pages">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block text-align="justify" id="surrounding"
+            space-before.minimum="10pt"
+            space-before.optimum="12pt"
+            space-before.maximum="50pt">
+            <fo:block space-before="inherit" id="b1">In olden times when wishing still helped one, 
+              there lived a king whose daughters were all beautiful, but the youngest was so 
+              beautiful that the sun itself, which has seen so much, was astonished whenever it 
+              shone in her face.</fo:block>
+            <fo:block space-before="inherit" id="b2">In olden times when wishing still helped one, 
+              there lived a king whose daughters were all beautiful, but the youngest was so 
+              beautiful that the sun itself, which has seen so much, was astonished whenever it 
+              shone in her face.</fo:block>
+            <fo:block space-before="inherit" id="b3">In olden times when wishing still helped one, 
+              there lived a king whose daughters were all beautiful, but the youngest was so 
+              beautiful that the sun itself, which has seen so much, was astonished whenever it 
+              shone in her face. In olden times when wishing still helped one, there lived a king 
+              whose daughters were all beautiful, but the youngest was so beautiful that the sun 
+              itself, which has seen so much, was astonished whenever it shone in her 
+              face.</fo:block>
+            <fo:block space-before="inherit" id="b4">In olden times when wishing still helped one, 
+              there lived a king whose daughters were all beautiful, but the youngest was so 
+              beautiful that the sun itself, which has seen so much, was astonished whenever it 
+              shone in her face.</fo:block>
+            <fo:block space-before="inherit" id="b5">In olden times when wishing still helped one, 
+              there lived a king whose daughters were all beautiful, but the youngest was so 
+              beautiful that the sun itself, which has seen so much, was astonished whenever it 
+              shone in her face.</fo:block>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="In"     xpath="//pageViewport[1]//flow/block/block[3]/lineArea[4]/text/word[position()=last()]"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block/block[1]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block/block[1]/lineArea[1]/@ipd"/>
+    <eval expected="olden"  xpath="//pageViewport[2]//flow/block/block[1]/lineArea[1]/text/word[1]"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block/block[2]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block/block[2]/lineArea[1]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block/block[3]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block/block[3]/lineArea[1]/@ipd"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_1.xml
------------------------------------------------------------------------------
    svn:keywords = Revision Id

Added: xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_2.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_2.xml?rev=788768&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_2.xml (added)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_2.xml Fri Jun 26 17:10:26 2009
@@ -0,0 +1,75 @@
+<?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">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="narrow"
+          page-height="300pt" page-width="400pt" margin="50pt">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+        <fo:simple-page-master master-name="wide"
+          page-height="300pt" page-width="600pt" margin="50pt">
+          <fo:region-body background-color="#F0F0F0"/>
+        </fo:simple-page-master>
+        <fo:page-sequence-master master-name="pages">
+          <fo:single-page-master-reference master-reference="narrow"/>
+          <fo:repeatable-page-master-reference master-reference="wide"/>
+        </fo:page-sequence-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="pages">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block id="b1">In olden times when wishing still helped one, there lived a king whose 
+            daughters were all beautiful, but the youngest was so beautiful that the sun itself, 
+            which has seen so much, was astonished whenever it shone in her face.</fo:block>
+          <fo:block id="b2">In olden times when wishing still helped one, there lived a king whose 
+            daughters were all beautiful, but the youngest was so beautiful that the sun itself, 
+            which has seen so much, was astonished whenever it shone in her face.</fo:block>
+          <fo:block id="b3">In olden times when wishing still helped one, there lived a king whose 
+            daughters were all beautiful, but the youngest was so beautiful that the sun itself, 
+            which has seen so much, was astonished whenever it shone in her face. In olden times 
+            when wishing still helped one, there lived a king whose daughters were all beautiful, 
+            but the youngest was so beautiful that the sun itself, which has seen so much, was 
+            astonished whenever it shone in her face.</fo:block>
+          <fo:block id="b4">In olden times when wishing still helped one, there lived a king whose 
+            daughters were all beautiful, but the youngest was so beautiful that the sun itself, 
+            which has seen so much, was astonished whenever it shone in her face.</fo:block>
+          <fo:block id="b5">In olden times when wishing still helped one, there lived a king whose 
+            daughters were all beautiful, but the youngest was so beautiful that the sun itself, 
+            which has seen so much, was astonished whenever it shone in her face.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="has"    xpath="//pageViewport[1]//flow/block[3]/lineArea[3]/text/word[position()=last()]"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block[1]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block[1]/lineArea[1]/@ipd"/>
+    <eval expected="seen"   xpath="//pageViewport[2]//flow/block[1]/lineArea[1]/text/word[1]"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block[2]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block[2]/lineArea[1]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block[3]/@ipd"/>
+    <eval expected="500000" xpath="//pageViewport[2]//flow/block[3]/lineArea[1]/@ipd"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/flow_changing-ipd_2.xml
------------------------------------------------------------------------------
    svn:keywords = Revision Id



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