Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
 Sun Aug 23 20:27:48 2009
@@ -24,6 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.Trait;
@@ -31,21 +32,23 @@
 import org.apache.fop.fo.flow.table.GridUnit;
 import org.apache.fop.fo.flow.table.PrimaryGridUnit;
 import org.apache.fop.fo.flow.table.Table;
-import org.apache.fop.fo.flow.table.TablePart;
 import org.apache.fop.fo.flow.table.TableCell;
 import org.apache.fop.fo.flow.table.TableColumn;
+import org.apache.fop.fo.flow.table.TablePart;
 import org.apache.fop.fo.flow.table.TableRow;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo;
 import org.apache.fop.layoutmgr.AreaAdditionUtil;
 import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
-import org.apache.fop.layoutmgr.KeepUtil;
+import org.apache.fop.layoutmgr.ElementListUtils;
+import org.apache.fop.layoutmgr.Keep;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthGlue;
 import org.apache.fop.layoutmgr.KnuthPenalty;
 import org.apache.fop.layoutmgr.LayoutContext;
+import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.PositionIterator;
 import org.apache.fop.layoutmgr.SpaceResolver;
@@ -138,9 +141,9 @@
         List contentList = new LinkedList();
         List returnList = new LinkedList();
 
-        BlockLevelLayoutManager curLM; // currently active LM
-        BlockLevelLayoutManager prevLM = null; // previously active LM
-        while ((curLM = (BlockLevelLayoutManager) getChildLM()) != null) {
+        LayoutManager curLM; // currently active LM
+        LayoutManager prevLM = null; // previously active LM
+        while ((curLM = getChildLM()) != null) {
             LayoutContext childLC = new LayoutContext(0);
             // curLM is a ?
             childLC.setStackLimitBP(MinOptMax.subtract(context
@@ -153,11 +156,12 @@
                 log.debug("child LM signals pending keep with next");
             }
             if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
-                
primaryGridUnit.setKeepWithPreviousStrength(childLC.getKeepWithPreviousPending());
+                
primaryGridUnit.setKeepWithPrevious(childLC.getKeepWithPreviousPending());
                 childLC.clearKeepWithPreviousPending();
             }
 
-            if (prevLM != null) {
+            if (prevLM != null
+                    && !ElementListUtils.endsWithForcedBreak(contentList)) {
                 // there is a block handled by prevLM
                 // before the one handled by curLM
                 addInBetweenBreak(contentList, context, childLC);
@@ -174,7 +178,7 @@
             }
             prevLM = curLM;
         }
-        
primaryGridUnit.setKeepWithNextStrength(context.getKeepWithNextPending());
+        primaryGridUnit.setKeepWithNext(context.getKeepWithNextPending());
 
         returnedList = new LinkedList();
         if (!contentList.isEmpty()) {
@@ -195,7 +199,7 @@
         }
         final KnuthElement lastItem = (KnuthElement) ListUtil
                 .getLast(returnList);
-        if (((KnuthElement) lastItem).isForcedBreak()) {
+        if (lastItem.isForcedBreak()) {
             KnuthPenalty p = (KnuthPenalty) lastItem;
             primaryGridUnit.setBreakAfter(p.getBreakClass());
             p.setP(0);
@@ -556,26 +560,23 @@
     }
 
     /** {...@inheritdoc} */
-    public int getKeepTogetherStrength() {
-        int strength = KEEP_AUTO;
+    public Keep getKeepTogether() {
+        Keep keep = Keep.KEEP_AUTO;
         if (primaryGridUnit.getRow() != null) {
-            strength = Math.max(strength, KeepUtil.getKeepStrength(
-                    
primaryGridUnit.getRow().getKeepTogether().getWithinPage()));
-            strength = Math.max(strength, KeepUtil.getKeepStrength(
-                    
primaryGridUnit.getRow().getKeepTogether().getWithinColumn()));
+            keep = Keep.getKeep(primaryGridUnit.getRow().getKeepTogether());
         }
-        strength = Math.max(strength, getParentKeepTogetherStrength());
-        return strength;
+        keep = keep.compare(getParentKeepTogether());
+        return keep;
     }
 
     /** {...@inheritdoc} */
-    public int getKeepWithNextStrength() {
-        return KEEP_AUTO; //TODO FIX ME (table-cell has no keep-with-next!)
+    public Keep getKeepWithNext() {
+        return Keep.KEEP_AUTO; //TODO FIX ME (table-cell has no 
keep-with-next!)
     }
 
     /** {...@inheritdoc} */
-    public int getKeepWithPreviousStrength() {
-        return KEEP_AUTO; //TODO FIX ME (table-cell has no keep-with-previous!)
+    public Keep getKeepWithPrevious() {
+        return Keep.KEEP_AUTO; //TODO FIX ME (table-cell has no 
keep-with-previous!)
     }
 
     // --------- Property Resolution related functions --------- //

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
 Sun Aug 23 20:27:48 2009
@@ -35,10 +35,9 @@
 import org.apache.fop.fo.flow.table.PrimaryGridUnit;
 import org.apache.fop.fo.flow.table.Table;
 import org.apache.fop.fo.flow.table.TablePart;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BreakElement;
 import org.apache.fop.layoutmgr.ElementListUtils;
-import org.apache.fop.layoutmgr.KeepUtil;
+import org.apache.fop.layoutmgr.Keep;
 import org.apache.fop.layoutmgr.KnuthBox;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthGlue;
@@ -213,13 +212,13 @@
         context.clearKeepsPending();
         context.setBreakBefore(Constants.EN_AUTO);
         context.setBreakAfter(Constants.EN_AUTO);
-        int keepWithPrevious = BlockLevelLayoutManager.KEEP_AUTO;
+        Keep keepWithPrevious = Keep.KEEP_AUTO;
         int breakBefore = Constants.EN_AUTO;
         if (rowGroup != null) {
             RowGroupLayoutManager rowGroupLM = new 
RowGroupLayoutManager(getTableLM(), rowGroup,
                     stepper);
             List nextRowGroupElems = rowGroupLM.getNextKnuthElements(context, 
alignment, bodyType);
-            keepWithPrevious = Math.max(keepWithPrevious, 
context.getKeepWithPreviousPending());
+            keepWithPrevious = 
keepWithPrevious.compare(context.getKeepWithPreviousPending());
             breakBefore = context.getBreakBefore();
             int breakBetween = context.getBreakAfter();
             returnList.addAll(nextRowGroupElems);
@@ -228,7 +227,7 @@
 
                 //Note previous pending keep-with-next and clear the strength
                 //(as the layout context is reused)
-                int keepWithNextPending = context.getKeepWithNextPending();
+                Keep keepWithNextPending = context.getKeepWithNextPending();
                 context.clearKeepWithNextPending();
 
                 //Get elements for next row group
@@ -246,17 +245,17 @@
                  */
 
                 //Determine keep constraints
-                int penaltyStrength = BlockLevelLayoutManager.KEEP_AUTO;
-                penaltyStrength = Math.max(penaltyStrength, 
keepWithNextPending);
-                penaltyStrength = Math.max(penaltyStrength, 
context.getKeepWithPreviousPending());
+                Keep keep = 
keepWithNextPending.compare(context.getKeepWithPreviousPending());
                 context.clearKeepWithPreviousPending();
-                penaltyStrength = Math.max(penaltyStrength, 
getTableLM().getKeepTogetherStrength());
-                int penaltyValue = KeepUtil.getPenaltyForKeep(penaltyStrength);
+                keep = keep.compare(getTableLM().getKeepTogether());
+                int penaltyValue = keep.getPenalty();
+                int breakClass = keep.getContext();
 
                 breakBetween = BreakUtil.compareBreakClasses(breakBetween,
                         context.getBreakBefore());
                 if (breakBetween != Constants.EN_AUTO) {
                     penaltyValue = -KnuthElement.INFINITE;
+                    breakClass = breakBetween;
                 }
                 BreakElement breakElement;
                 ListIterator elemIter = 
returnList.listIterator(returnList.size());
@@ -267,7 +266,7 @@
                     breakElement = (BreakElement) elem;
                 }
                 breakElement.setPenaltyValue(penaltyValue);
-                breakElement.setBreakClass(breakBetween);
+                breakElement.setBreakClass(breakClass);
                 returnList.addAll(nextRowGroupElems);
                 breakBetween = context.getBreakAfter();
             }

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
 Sun Aug 23 20:27:48 2009
@@ -35,11 +35,11 @@
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.flow.table.Table;
 import org.apache.fop.fo.flow.table.TableColumn;
+import org.apache.fop.fo.properties.KeepProperty;
 import org.apache.fop.layoutmgr.BlockLevelEventProducer;
 import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
 import org.apache.fop.layoutmgr.BreakElement;
 import org.apache.fop.layoutmgr.ConditionalElementListener;
-import org.apache.fop.layoutmgr.KeepUtil;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthGlue;
 import org.apache.fop.layoutmgr.LayoutContext;
@@ -256,10 +256,10 @@
         log.debug(contentKnuthElements);
         wrapPositionElements(contentKnuthElements, returnList);
 
-        context.updateKeepWithPreviousPending(getKeepWithPreviousStrength());
+        context.updateKeepWithPreviousPending(getKeepWithPrevious());
         
context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
 
-        context.updateKeepWithNextPending(getKeepWithNextStrength());
+        context.updateKeepWithNextPending(getKeepWithNext());
         context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
 
         if (getTable().isSeparateBorderModel()) {
@@ -448,20 +448,18 @@
     }
 
     /** {...@inheritdoc} */
-    public int getKeepTogetherStrength() {
-        int strength = 
KeepUtil.getCombinedBlockLevelKeepStrength(getTable().getKeepTogether());
-        strength = Math.max(strength, getParentKeepTogetherStrength());
-        return strength;
+    public KeepProperty getKeepTogetherProperty() {
+        return getTable().getKeepTogether();
     }
 
     /** {...@inheritdoc} */
-    public int getKeepWithNextStrength() {
-        return 
KeepUtil.getCombinedBlockLevelKeepStrength(getTable().getKeepWithNext());
+    public KeepProperty getKeepWithPreviousProperty() {
+        return getTable().getKeepWithPrevious();
     }
 
     /** {...@inheritdoc} */
-    public int getKeepWithPreviousStrength() {
-        return 
KeepUtil.getCombinedBlockLevelKeepStrength(getTable().getKeepWithPrevious());
+    public KeepProperty getKeepWithNextProperty() {
+        return getTable().getKeepWithNext();
     }
 
     // --------- Property Resolution related functions --------- //

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java 
Sun Aug 23 20:27:48 2009
@@ -30,12 +30,10 @@
 import org.apache.fop.fo.flow.table.EffRow;
 import org.apache.fop.fo.flow.table.GridUnit;
 import org.apache.fop.fo.flow.table.PrimaryGridUnit;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BreakElement;
-import org.apache.fop.layoutmgr.KeepUtil;
+import org.apache.fop.layoutmgr.Keep;
 import org.apache.fop.layoutmgr.KnuthBlockBox;
 import org.apache.fop.layoutmgr.KnuthBox;
-import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.KnuthGlue;
 import org.apache.fop.layoutmgr.KnuthPenalty;
 import org.apache.fop.layoutmgr.LayoutContext;
@@ -241,40 +239,38 @@
                 }
             }
 
-            int strength = BlockLevelLayoutManager.KEEP_AUTO;
+            Keep keep = Keep.KEEP_AUTO;
             int stepPenalty = 0;
             for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
                 ActiveCell activeCell = (ActiveCell) iter.next();
-                strength = Math.max(strength, 
activeCell.getKeepWithNextStrength());
+                keep = keep.compare(activeCell.getKeepWithNext());
                 stepPenalty = Math.max(stepPenalty, 
activeCell.getPenaltyValue());
             }
             if (!rowFinished) {
-                strength = Math.max(strength, 
rowGroup[activeRowIndex].getKeepTogetherStrength());
+                keep = 
keep.compare(rowGroup[activeRowIndex].getKeepTogether());
                 //The above call doesn't take the penalty from the table into 
account, so...
-                strength = Math.max(strength, 
getTableLM().getKeepTogetherStrength());
+                keep = keep.compare(getTableLM().getKeepTogether());
             } else if (activeRowIndex < rowGroup.length - 1) {
-                strength = Math.max(strength,
-                        rowGroup[activeRowIndex].getKeepWithNextStrength());
-                strength = Math.max(strength,
-                        rowGroup[activeRowIndex + 
1].getKeepWithPreviousStrength());
+                keep = 
keep.compare(rowGroup[activeRowIndex].getKeepWithNext());
+                keep = keep.compare(rowGroup[activeRowIndex + 
1].getKeepWithPrevious());
                 nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
                         rowGroup[activeRowIndex].getBreakAfter());
                 nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass,
                         rowGroup[activeRowIndex + 1].getBreakBefore());
             }
-            int p = KeepUtil.getPenaltyForKeep(strength);
+            int p = keep.getPenalty();
             if (rowHeightSmallerThanFirstStep) {
                 rowHeightSmallerThanFirstStep = false;
                 p = KnuthPenalty.INFINITE;
             }
-            if (p > -KnuthElement.INFINITE) {
-                p = Math.max(p, stepPenalty);
-            }
+            p = Math.max(p, stepPenalty);
+            int breakClass = keep.getContext();
             if (nextBreakClass != Constants.EN_AUTO) {
                 log.trace("Forced break encountered");
                 p = -KnuthPenalty.INFINITE; //Overrides any keeps (see 4.8 in 
XSL 1.0)
+                breakClass = nextBreakClass;
             }
-            returnList.add(new BreakElement(penaltyPos, effPenaltyLen, p, 
nextBreakClass, context));
+            returnList.add(new BreakElement(penaltyPos, effPenaltyLen, p, 
breakClass, context));
             if (penaltyOrGlueLen < 0) {
                 returnList.add(new KnuthGlue(-penaltyOrGlueLen, 0, 0, new 
Position(null), true));
             }

Modified: xmlgraphics/fop/trunk/status.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Sun Aug 23 20:27:48 2009
@@ -58,6 +58,9 @@
       documents. Example: the fix of marks layering will be such a case when 
it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Renderers" dev="AD" type="add" fixes-bug="46905">
+        Added basic implementation for column-keeps.
+      </action>
       <action context="Renderers" dev="AD" type="fix" fixes-bug="46883">
         Hotspot in AbstractGraphicsDrawingOrderContainer. Reduced time spent 
in the method
         by introducing a member variable to hold the data-length.

Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Sun Aug 23 
20:27:48 2009
@@ -216,4 +216,10 @@
     <description>A soft hyphen should be a preferred as break compared to a
     normal hyphenation point but is not.</description>
   </testcase>
+  <testcase>
+    <name>Page-keep not respected in multi-column layout</name>
+    <file>keep_within-page_multi-column_overflow.xml</file>
+    <description>The block should cause overflow in the
+    last column on the page, rather than be broken.</description>
+  </testcase>
 </disabled-testcases>

Modified: 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_block_nested_6.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_block_nested_6.xml?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_block_nested_6.xml
 (original)
+++ 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/inline_block_nested_6.xml
 Sun Aug 23 20:27:48 2009
@@ -52,16 +52,15 @@
       <skip>5</skip>
       <!-- penalty between blocks b11 and b12, set by InlineLM in b1 -->
       <penalty w="0" p="0"/>
-      <skip>6</skip>
+      <skip>5</skip>
       <!-- penalty between blocks b21 and b22, set by InlineLM in b2 -->
       <!-- keep-together.within-page="always" -->
       <penalty w="0" p="1000"/>
-      <skip>6</skip>
+      <skip>3</skip>
       <!-- penalty between blocks b31 and b32, set by InlineLM in b3 -->
       <!-- keep-with-next.within-page="always" -->
       <penalty w="0" p="1000"/>
-      <skip>5</skip>
-      <skip>3</skip>
+      <skip>14</skip>
     </element-list>
   </checks>
 </testcase>                              

Added: 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-column_basic.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-column_basic.xml?rev=807014&view=auto
==============================================================================
--- 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-column_basic.xml
 (added)
+++ 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-column_basic.xml
 Sun Aug 23 20:27:48 2009
@@ -0,0 +1,155 @@
+<?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 whether keeps within-column are respected.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page" page-width="400pt" 
page-height="70pt">
+          <fo:region-body column-count="5" />
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="page" font-size="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block break-before="page">
+            <!-- simple test: keep the second block together within
+                 one column, breaking the preceding block early 
+                 if necessary -->
+            <fo:block id="block-1">
+              [BOB-1] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-1]
+            </fo:block>
+            <fo:block id="block-2" keep-together.within-column="always">
+              [BOB-2] foo bar foo bar foo bar foo bar foo [EOB-2]
+            </fo:block>
+          </fo:block>
+          <fo:block break-before="page">
+            <!-- same as the first, but now a nested block
+                 with a higher integer value, and some content
+                 following -->
+            <fo:block id="block-3" keep-together.within-column="5">
+              [BOB-3] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              <fo:block font-weight="bold" id="block-3a" 
keep-together.within-column="always">
+                [BOB-3a] foo bar foo bar foo bar foo bar foo [EOB-3a]
+              </fo:block>
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-3]
+            </fo:block>
+          </fo:block>
+          <fo:block break-before="page">
+            <!-- nested block must be kept together within the same
+                 page, while the outer block may be broken, if necessary -->
+            <fo:block font-style="italic" id="block-4" 
keep-together.within-column="5">
+              [BOB-4] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              <fo:block id="block-4a" keep-together.within-page="always">
+                [BOB-4a] foo bar foo bar foo bar foo bar foo bar
+                foo bar foo bar foo bar foo bar foo bar foo bar
+                foo bar foo bar foo bar foo bar foo bar foo bar
+                foo bar foo bar foo bar foo bar foo bar foo bar
+                foo bar foo bar foo bar foo bar foo bar foo bar
+                foo bar foo bar foo bar foo bar foo bar foo bar
+                foo bar foo bar foo bar foo bar foo bar foo bar
+                foo bar foo bar foo bar foo bar foo bar [EOB-4a]
+              </fo:block>
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-4]
+            </fo:block>
+          </fo:block>
+          <fo:block break-before="page">
+            <!-- test keep-with-next in conjunction with keep-together
+                 respecting the default value for widows/orphans -->
+            <fo:block id="block-5">
+              <fo:block id="block-5a">
+              [BOB-5a] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-5a]
+              </fo:block>
+              <fo:block id="block-5b" keep-with-next.within-column="always">
+              [BOB-5b] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-5b]
+              </fo:block>
+              <fo:block id="block-5c" keep-together.within-column="always">
+              [BOB-5c] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-5c]
+              </fo:block>
+            </fo:block>
+          </fo:block>
+          <fo:block break-before="page">
+            <!-- test keep-together in conjunction with keep-with-previous -->
+            <fo:block id="block-6">
+              <fo:block id="block-6a">
+              [BOB-6a] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-6a]
+              </fo:block>
+              <fo:block id="block-6b" keep-together.within-column="always">
+              [BOB-6b] foo bar foo bar foo bar foo bar foo bar [EOB-6b]
+              </fo:block>
+              <fo:block id="block-6c" 
keep-with-previous.within-column="always">
+              [BOB-6c] foo bar foo bar foo bar foo bar foo bar
+              foo bar foo bar foo bar foo bar foo bar [EOB-6c]
+              </fo:block>
+            </fo:block>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <!-- check total page-count -->
+    <eval expected="10" xpath="count(//page)" />
+    <!-- block-2 should end up in its own column, column 4 -->
+    <eval expected="1" 
xpath="count(//blo...@prod-id='block-2']/ancestor::flow)" />
+    <eval expected="3" 
xpath="count(//blo...@prod-id='block-2']/ancestor::flow/preceding-sibling::flow)"
 />
+    <!-- block-3a should end up in its own column, column 5 -->
+    <eval expected="1" 
xpath="count(//blo...@prod-id='block-3a']/ancestor::flow)" />
+    <eval expected="4" 
xpath="count(//blo...@prod-id='block-3a']/ancestor::flow/preceding-sibling::flow)"
 />
+    <!-- block-4a should end up in its own page -->
+    <eval expected="1" 
xpath="count(//blo...@prod-id='block-4a']/ancestor::page)" />
+    <!-- block 5c should end up in its own column, with two preceding lines 
from block 5b -->
+    <eval expected="1" 
xpath="count(//blo...@prod-id='block-5c']/ancestor::flow)" />
+    <eval expected="2" 
xpath="count(//blo...@prod-id='block-5c']/preceding-sibling::block/lineArea)" />
+    <!-- block 6b should end up in its own column, with two following lines 
from block 6c -->
+    <eval expected="1" 
xpath="count(//blo...@prod-id='block-6b']/ancestor::flow)" />
+    <eval expected="2" 
xpath="count(//blo...@prod-id='block-6b']/following-sibling::block/lineArea)" />
+  </checks>
+</testcase>
+

Added: 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml?rev=807014&view=auto
==============================================================================
--- 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml
 (added)
+++ 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml
 Sun Aug 23 20:27:48 2009
@@ -0,0 +1,58 @@
+<?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 for a remaining issue after adding support
+      for keep-*.within column (see Bugzilla 46905). 
+      keep-together.within-page does not work as expected in multi-column
+      layout. If the part does not fit into one page, it will ultimately
+      still be broken.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page" page-width="400pt" 
page-height="70pt">
+          <fo:region-body column-count="5" />
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="page" font-size="10pt">
+        <fo:flow flow-name="xsl-region-body">
+          <!-- block must be kept together within the same page -->
+          <fo:block id="block-4a" keep-together.within-page="always">
+            [BOB-4a] foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar foo bar
+            foo bar foo bar foo bar foo bar foo bar [EOB-4a]
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="1" xpath="count(//pageViewport)" />
+  </checks>
+</testcase>

Modified: 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-row_keep-together.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-row_keep-together.xml?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-row_keep-together.xml
 (original)
+++ 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-row_keep-together.xml
 Sun Aug 23 20:27:48 2009
@@ -64,10 +64,10 @@
     <element-list category="breaker" index="0">
       <box w="14400"/>
       <penalty w="0" p="0"/>
-      <box w="28800"/>
-      <penalty w="0" p="0"/>
       <box w="14400"/>
-      <skip>3</skip>
+      <penalty w="0" p="INF"/>
+      <box w="14400"/>
+      <skip>5</skip>
     </element-list>
   </checks>
 </testcase>

Modified: 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml?rev=807014&r1=807013&r2=807014&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml
 (original)
+++ 
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table_keep-together.xml
 Sun Aug 23 20:27:48 2009
@@ -101,7 +101,9 @@
     <element-list category="breaker" index="0">
       <box w="14400"/>
       <penalty w="0" p="0"/>
-      <box w="28800"/>
+      <box w="14400"/>
+      <penalty w="0" p="INF"/>
+      <box w="14400"/>
       <penalty w="0" p="INF"/>
       <box w="14400"/>
       <penalty w="0" p="0"/>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to