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 bc...@apache.org on 2005/08/31 22:30:49 UTC

svn commit: r265577 [4/5] - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/area/ src/java/org/apache/fop/datatypes/ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/expr/ src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/fo/pagination/...

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Wed Aug 31 13:29:33 2005
@@ -132,7 +132,6 @@
     private int total = 0;
     private int middle = 0;
     private int verticalAlignment = EN_BASELINE;
-
     /**
      * Create a Text layout manager.
      *
@@ -147,8 +146,10 @@
             node.endIndex - node.startIndex);
 
         vecAreaInfo = new java.util.ArrayList();
-
-        fs = foText.getCommonFont().getFontState(foText.getFOEventHandler().getFontInfo());
+    }
+    
+    public void initialize() {
+        fs = foText.getCommonFont().getFontState(foText.getFOEventHandler().getFontInfo(), this);
         
         // With CID fonts, space isn't neccesary currentFontState.width(32)
         spaceCharIPD = fs.getCharWidth(' ');

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java Wed Aug 31 13:29:33 2005
@@ -1,55 +1,56 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- * 
- * Licensed 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$ */
-
-package org.apache.fop.layoutmgr.inline;
-
-import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.fo.flow.Wrapper;
-import org.apache.fop.layoutmgr.LayoutContext;
-
-/**
- * This is the layout manager for the fo:wrapper formatting object.
- */
-public class WrapperLayoutManager extends LeafNodeLayoutManager {
-    
-    private Wrapper fobj;
-
-    /**
-     * Creates a new LM for fo:wrapper.
-     * @param node the fo:wrapper
-     */
-    public WrapperLayoutManager(Wrapper node) {
-        super(node);
-        fobj = node;
-    }
-
-    /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager */
-    public InlineArea get(LayoutContext context) {
-        //Create a zero-width, zero-height dummy area so this node can 
-        //participate in the ID handling. Otherwise, addId() wouldn't 
-        //be called.
-        InlineArea area = new InlineArea();
-        return area;
-    }
-    
-    /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#addId() */
-    protected void addId() {
-        getPSLM().addIDToPage(fobj.getId());
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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$ */
+
+package org.apache.fop.layoutmgr.inline;
+
+import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.fo.flow.Wrapper;
+import org.apache.fop.layoutmgr.LayoutContext;
+import org.apache.fop.layoutmgr.LayoutManager;
+
+/**
+ * This is the layout manager for the fo:wrapper formatting object.
+ */
+public class WrapperLayoutManager extends LeafNodeLayoutManager {
+    
+    private Wrapper fobj;
+
+    /**
+     * Creates a new LM for fo:wrapper.
+     * @param node the fo:wrapper
+     */
+    public WrapperLayoutManager(Wrapper node) {
+        super(node);
+        fobj = node;
+    }
+
+    /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager */
+    public InlineArea get(LayoutContext context) {
+        //Create a zero-width, zero-height dummy area so this node can 
+        //participate in the ID handling. Otherwise, addId() wouldn't 
+        //be called.
+        InlineArea area = new InlineArea();
+        return area;
+    }
+    
+    /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#addId() */
+    protected void addId() {
+        getPSLM().addIDToPage(fobj.getId());
+    }
+    
+}

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Wed Aug 31 13:29:33 2005
@@ -42,6 +42,7 @@
  * the list block area..
  */
 public class ListBlockLayoutManager extends BlockStackingLayoutManager {
+
     private Block curBlockArea;
 
     //TODO space-before|after: handle space-resolution rules
@@ -72,10 +73,10 @@
     /**
      * Create a new list block layout manager.
      * @param node list-block to create the layout manager for
+     * @param parent the parent layout manager
      */
     public ListBlockLayoutManager(ListBlock node) {
         super(node);
-        initialize();
     }
 
     /**
@@ -86,15 +87,15 @@
         return (ListBlock)fobj;
     }
 
-    private void initialize() {
-        foSpaceBefore = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceBefore).getSpace();
-        foSpaceAfter = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceAfter).getSpace();
+    public void initialize() {
+        foSpaceBefore = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceBefore, this).getSpace();
+        foSpaceAfter = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceAfter, this).getSpace();
     }
 
     private int getIPIndents() {
         int iIndents = 0;
-        iIndents += getListBlockFO().getCommonMarginBlock().startIndent.getValue();
-        iIndents += getListBlockFO().getCommonMarginBlock().endIndent.getValue();
+        iIndents += getListBlockFO().getCommonMarginBlock().startIndent.getValue(this);
+        iIndents += getListBlockFO().getCommonMarginBlock().endIndent.getValue(this);
         return iIndents;
     }
     
@@ -180,6 +181,11 @@
             getCurrentPV().addMarkers(markers, false, isFirst(firstPos), isLast(lastPos));
         }
 
+        // We are done with this area add the background
+        TraitSetter.addBackground(curBlockArea, 
+                getListBlockFO().getCommonBorderPaddingBackground(),
+                this);
+
         flush();
 
         // if adjusted space after
@@ -212,18 +218,17 @@
             // set traits
             TraitSetter.setProducerID(curBlockArea, getListBlockFO().getId());
             TraitSetter.addBorders(curBlockArea, 
-                    getListBlockFO().getCommonBorderPaddingBackground());
+            getListBlockFO().getCommonBorderPaddingBackground(), this);
             TraitSetter.addMargins(curBlockArea,
                     getListBlockFO().getCommonBorderPaddingBackground(), 
-                    getListBlockFO().getCommonMarginBlock());
+                    getListBlockFO().getCommonMarginBlock(),
+                    this);
             TraitSetter.addBreaks(curBlockArea, 
                     getListBlockFO().getBreakBefore(), 
                     getListBlockFO().getBreakAfter());
             
             int contentIPD = referenceIPD - getIPIndents();
             curBlockArea.setIPD(contentIPD);
-            TraitSetter.addBackground(curBlockArea, 
-                    getListBlockFO().getCommonBorderPaddingBackground());
             
             setCurrentArea(curBlockArea);
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Wed Aug 31 13:29:33 2005
@@ -57,7 +57,7 @@
     private LinkedList bodyList = null;
 
     private int listItemHeight;
-
+    
     //TODO space-before|after: handle space-resolution rules
     
     private boolean keepWithNextPendingOnLabel;
@@ -122,7 +122,6 @@
         super(node);
         setLabel(node.getLabel());
         setBody(node.getBody());
-        initialize();
     }
 
     /**
@@ -151,15 +150,15 @@
         body.setParent(this);
     }
 
-    private void initialize() {
-        foSpaceBefore = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceBefore).getSpace();
-        foSpaceAfter = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceAfter).getSpace();
+    public void initialize() {
+        foSpaceBefore = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceBefore, this).getSpace();
+        foSpaceAfter = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceAfter, this).getSpace();
     }
 
     private int getIPIndents() {
         int iIndents = 0;
-        iIndents += getListItemFO().getCommonMarginBlock().startIndent.getValue();
-        iIndents += getListItemFO().getCommonMarginBlock().endIndent.getValue();
+        iIndents += getListItemFO().getCommonMarginBlock().startIndent.getValue(this);
+        iIndents += getListItemFO().getCommonMarginBlock().endIndent.getValue(this);
         return iIndents;
     }
     
@@ -178,6 +177,7 @@
         // label
         childLC = new LayoutContext(0);
         childLC.setRefIPD(context.getRefIPD());
+        label.initialize();
         labelList = label.getNextKnuthElements(childLC, alignment);
         if (childLC.isKeepWithPreviousPending()) {
             context.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING);
@@ -187,6 +187,7 @@
         // body
         childLC = new LayoutContext(0);
         childLC.setRefIPD(context.getRefIPD());
+        body.initialize();
         bodyList = body.getNextKnuthElements(childLC, alignment);
         if (childLC.isKeepWithPreviousPending()) {
             context.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING);
@@ -504,6 +505,11 @@
             getCurrentPV().addMarkers(markers, false, isFirst(firstPos), isLast(lastPos));
         }
 
+        // We are done with this area add the background
+        TraitSetter.addBackground(curBlockArea, 
+                getListItemFO().getCommonBorderPaddingBackground(),
+                this);
+
         flush();
 
         // if adjusted space after
@@ -545,12 +551,10 @@
             // set traits
             TraitSetter.setProducerID(curBlockArea, getListItemFO().getId());
             TraitSetter.addBorders(curBlockArea, 
-                    getListItemFO().getCommonBorderPaddingBackground());
-            TraitSetter.addBackground(curBlockArea, 
-                    getListItemFO().getCommonBorderPaddingBackground());
+                    getListItemFO().getCommonBorderPaddingBackground(), this);
             TraitSetter.addMargins(curBlockArea,
                     getListItemFO().getCommonBorderPaddingBackground(), 
-                    getListItemFO().getCommonMarginBlock());
+                    getListItemFO().getCommonMarginBlock(), this);
             TraitSetter.addBreaks(curBlockArea, 
                     getListItemFO().getBreakBefore(), 
                     getListItemFO().getBreakAfter());

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java Wed Aug 31 13:29:33 2005
@@ -24,6 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.fop.datatypes.PercentBaseContext;
 
 import org.apache.fop.fo.flow.Table;
 import org.apache.fop.fo.flow.TableColumn;
@@ -127,12 +128,13 @@
 
     /**
      * @param col column index (1 is first column)
+     * @param context the context for percentage based calculations
      * @return the X offset of the requested column
      */
-    public int getXOffset(int col) {
+    public int getXOffset(int col, PercentBaseContext context) {
         int xoffset = 0;
         for (int i = 1; i < col; i++) {
-            xoffset += getColumn(i).getColumnWidth().getValue();
+            xoffset += getColumn(i).getColumnWidth().getValue(context);
         }
         return xoffset;
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/GridUnit.java Wed Aug 31 13:29:33 2005
@@ -245,6 +245,9 @@
         this.effBorders.setBorderInfo(
                 borderModel.determineWinner(this, other, 
                         side, resFlags), side);
+        if (cell != null) {
+            this.effBorders.setPadding(this.cell.getCommonBorderPaddingBackground());
+        }
     }
     
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/PrimaryGridUnit.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/PrimaryGridUnit.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/PrimaryGridUnit.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/PrimaryGridUnit.java Wed Aug 31 13:29:33 2005
@@ -23,6 +23,7 @@
 
 import org.apache.fop.fo.flow.TableCell;
 import org.apache.fop.fo.flow.TableColumn;
+import org.apache.fop.layoutmgr.LayoutManager;
 
 /**
  * This class represents a primary grid unit of a spanned cell.
@@ -131,11 +132,11 @@
 
     /** @return true if cell/row has an explicit BPD/height */
     public boolean hasBPD() {
-        if (!getCell().getBlockProgressionDimension().getOptimum().isAuto()) {
+        if (!getCell().getBlockProgressionDimension().getOptimum(null).isAuto()) {
             return true;
         }
         if (getRow() != null 
-                && !getRow().getBlockProgressionDimension().getOptimum().isAuto()) {
+                && !getRow().getBlockProgressionDimension().getOptimum(null).isAuto()) {
             return true;
         }
         return false;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=265577&r1=265576&r2=265577&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 Wed Aug 31 13:29:33 2005
@@ -37,6 +37,7 @@
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.Trait;
+import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.traits.MinOptMax;
 
 /**
@@ -71,11 +72,10 @@
         super(node);
         fobj = node;
         this.gridUnit = pgu;
-        initialize();
     }
 
     /** @return the table-cell FO */
-    public TableCell getFObj() {
+    public TableCell getTableCell() {
         return this.fobj;
     }
     
@@ -83,15 +83,15 @@
         return fobj.isSeparateBorderModel();
     }
     
-    private void initialize() {
+    public void initialize() {
         borderAndPaddingBPD = 0;
         borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
         borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false);
         if (!isSeparateBorderModel()) {
             borderAndPaddingBPD /= 2;
         }
-        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingBefore(false);
-        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingAfter(false);
+        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingBefore(false, this);
+        borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingAfter(false, this);
     }
     
     /**
@@ -116,8 +116,8 @@
         if (!isSeparateBorderModel()) {
             iIndents /= 2;
         }
-        iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
-        iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false);
+        iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
+        iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false, this);
         return iIndents;
     }
     
@@ -132,7 +132,7 @@
         cellIPD -= getIPIndents();
         if (isSeparateBorderModel()) {
             int borderSep = fobj.getBorderSeparation().getLengthPair()
-                    .getIPD().getLength().getValue();
+                    .getIPD().getLength().getValue(this);
             cellIPD -= borderSep;
         }
 
@@ -298,8 +298,8 @@
         }
         CommonBorderPaddingBackground cbpb 
             = gu.getCell().getCommonBorderPaddingBackground(); 
-        bpd -= cbpb.getPaddingBefore(false);
-        bpd -= cbpb.getPaddingAfter(false);
+        bpd -= cbpb.getPaddingBefore(false, this);
+        bpd -= cbpb.getPaddingAfter(false, this);
         return bpd;
     }
     
@@ -317,7 +317,11 @@
 
         getPSLM().addIDToPage(fobj.getId());
 
-        if (!isSeparateBorderModel()) {
+        if (isSeparateBorderModel()) {
+            if (!emptyCell || fobj.showEmptyCells()) {
+                TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
+            }
+        } else {
             boolean[] outer = new boolean[] {
                     gridUnit.getFlag(GridUnit.FIRST_IN_TABLE), 
                     gridUnit.getFlag(GridUnit.LAST_IN_TABLE),
@@ -326,7 +330,7 @@
             if (!gridUnit.hasSpanning()) {
                 //Can set the borders directly if there's no span
                 TraitSetter.addCollapsingBorders(curBlockArea, 
-                        gridUnit.getBorders(), outer);
+                        gridUnit.getBorders(), outer, this);
             } else {
                 int dy = yoffset;
                 for (int y = 0; y < gridUnit.getRows().size(); y++) {
@@ -356,7 +360,7 @@
                         }
                         block.setBPD(bpd);
                         lastRowHeight = rowHeight;
-                        int ipd = gu.getColumn().getColumnWidth().getValue();
+                        int ipd = gu.getColumn().getColumnWidth().getValue(this);
                         int borderStartWidth = gu.getBorders().getBorderStartWidth(false) / 2; 
                         ipd -= borderStartWidth;
                         ipd -= gu.getBorders().getBorderEndWidth(false) / 2;
@@ -368,9 +372,9 @@
                                 += gu.getBorders().getBorderBeforeWidth(false) / 2;
                         }
                         block.setYOffset(dy - halfCollapsingBorderHeight);
-                        TraitSetter.addCollapsingBorders(block, gu.getBorders(), outer);
+                        TraitSetter.addCollapsingBorders(block, gu.getBorders(), outer, this);
                         parentLM.addChildArea(block);
-                        dx += gu.getColumn().getColumnWidth().getValue();
+                        dx += gu.getColumn().getColumnWidth().getValue(this);
                     }
                     dy += lastRowHeight;
                 }
@@ -396,13 +400,17 @@
         
         curBlockArea.setBPD(contentBPD);
 
+        // Add background after we know the BPD
         if (isSeparateBorderModel()) {
             if (!emptyCell || fobj.showEmptyCells()) {
-                TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
-                TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+                TraitSetter.addBackground(curBlockArea,
+                                          fobj.getCommonBorderPaddingBackground(),
+                                          this);
             }
         } else {
-            TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+            TraitSetter.addBackground(curBlockArea,
+                                      fobj.getCommonBorderPaddingBackground(),
+                                      this);
         }
         
         flush();
@@ -434,12 +442,12 @@
             if (!isSeparateBorderModel()) {
                 indent /= 2;
             }
-            indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
+            indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
             // set position
             int halfBorderSep = 0;
             if (isSeparateBorderModel()) {
                 halfBorderSep = fobj.getBorderSeparation().getLengthPair()
-                        .getIPD().getLength().getValue() / 2;
+                        .getIPD().getLength().getValue(this) / 2;
             }
             int borderAdjust = 0;
             if (!isSeparateBorderModel()) {
@@ -533,6 +541,43 @@
         return !fobj.getKeepWithNext().getWithinPage().isAuto()
             || !fobj.getKeepWithNext().getWithinColumn().isAuto();
             */
+    }
+    
+    // --------- Property Resolution related functions --------- //
+    
+    /**
+     * Returns the IPD of the content area
+     * @return the IPD of the content area
+     */
+    public int getContentAreaIPD() {
+        return cellIPD;
+    }
+   
+    /**
+     * Returns the BPD of the content area
+     * @return the BPD of the content area
+     */
+    public int getContentAreaBPD() {
+        if (curBlockArea != null) {
+            return curBlockArea.getBPD();
+        } else {
+            log.error("getContentAreaBPD called on unknown BPD");
+            return -1;
+        }
+    }
+   
+    /**
+     * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesReferenceArea
+     */
+    public boolean getGeneratesReferenceArea() {
+        return true;
+    }
+   
+    /**
+     * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesBlockArea
+     */
+    public boolean getGeneratesBlockArea() {
+        return true;
     }
 
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=265577&r1=265576&r2=265577&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 Wed Aug 31 13:29:33 2005
@@ -28,7 +28,9 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.Trait;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.flow.Table;
 import org.apache.fop.fo.flow.TableBody;
 import org.apache.fop.fo.flow.TableRow;
@@ -51,7 +53,7 @@
 /**
  * Layout manager for table contents, particularly managing the creation of combined element lists.
  */
-public class TableContentLayoutManager {
+public class TableContentLayoutManager implements PercentBaseContext {
 
     /** Logger **/
     private static Log log = LogFactory.getLog(TableContentLayoutManager.class);
@@ -415,7 +417,7 @@
                     PrimaryGridUnit primary = gu.getPrimary();
                     
                     if (gu.isPrimary()) {
-                        primary.getCellLM().setParent(tableLM);
+                        primary.getCellLM().setParent(getTableLM());
                      
                         //Determine the table-row if any
                         if (tableRow == null && primary.getRow() != null) {
@@ -423,11 +425,11 @@
                             
                             //Check for bpd on row, see CSS21, 17.5.3 Table height algorithms
                             LengthRangeProperty bpd = tableRow.getBlockProgressionDimension();
-                            if (!bpd.getMinimum().isAuto()) {
+                            if (!bpd.getMinimum(getTableLM()).isAuto()) {
                                 minContentHeight = Math.max(minContentHeight, 
-                                        bpd.getMinimum().getLength().getValue());
+                                        bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
                             }
-                            MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd);
+                            MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd, getTableLM());
                             
                         }
 
@@ -438,7 +440,7 @@
                                         + primary.getCell().getNumberColumnsSpanned();
                                 i++) {
                             spanWidth += getTableLM().getColumns().getColumn(i + 1)
-                                .getColumnWidth().getValue();
+                                .getColumnWidth().getValue(getTableLM());
                         }
                         LayoutContext childLC = new LayoutContext(0);
                         childLC.setStackLimit(context.getStackLimit()); //necessary?
@@ -487,17 +489,17 @@
                     if (gu.isLastGridUnitRowSpan()) {
                         int effCellContentHeight = minContentHeight;
                         LengthRangeProperty bpd = primary.getCell().getBlockProgressionDimension();
-                        if (!bpd.getMinimum().isAuto()) {
+                        if (!bpd.getMinimum(getTableLM()).isAuto()) {
                             effCellContentHeight = Math.max(effCellContentHeight,
-                                    bpd.getMinimum().getLength().getValue());
+                                    bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
                         }
-                        if (!bpd.getOptimum().isAuto()) {
+                        if (!bpd.getOptimum(getTableLM()).isAuto()) {
                             effCellContentHeight = Math.max(effCellContentHeight,
-                                    bpd.getOptimum().getLength().getValue());
+                                    bpd.getOptimum(getTableLM()).getLength().getValue(getTableLM()));
                         }
                         if (gu.getRowSpanIndex() == 0) {
                             //TODO ATM only non-row-spanned cells are taken for this
-                            MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd);
+                            MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd, tableLM);
                         }
                         effCellContentHeight = Math.max(effCellContentHeight, 
                                 primary.getContentLength());
@@ -514,8 +516,8 @@
                                 effCellContentHeight);
                         CommonBorderPaddingBackground cbpb 
                             = primary.getCell().getCommonBorderPaddingBackground(); 
-                        padding += cbpb.getPaddingBefore(false);
-                        padding += cbpb.getPaddingAfter(false);
+                        padding += cbpb.getPaddingBefore(false, primary.getCellLM());
+                        padding += cbpb.getPaddingAfter(false, primary.getCellLM());
                         int effRowHeight = effCellContentHeight + padding + borderWidths;
                         for (int previous = 0; previous < gu.getRowSpanIndex(); previous++) {
                             effRowHeight -= rowHeights[rgi - previous - 1].opt;
@@ -566,7 +568,7 @@
      */
     protected int getXOffsetOfGridUnit(GridUnit gu) {
         int col = gu.getStartCol();
-        return startXOffset + getTableLM().getColumns().getXOffset(col + 1);
+        return startXOffset + getTableLM().getColumns().getXOffset(col + 1, getTableLM());
     }
     
     /**
@@ -792,36 +794,41 @@
                             gridUnits[i].getElements(), start[i], end[i]);
                     partLength[i] = len;
                     log.debug("len of part: " + len);
+
                     if (start[i] == 0) {
                         LengthRangeProperty bpd = gridUnits[i].getCell()
                                 .getBlockProgressionDimension();
-                        if (!bpd.getMinimum().isAuto()) {
-                            if (bpd.getMinimum().getLength().getValue() > 0) {
-                                len = Math.max(len, bpd.getMinimum().getLength().getValue());
+                        if (!bpd.getMinimum(getTableLM()).isAuto()) {
+                            if (bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()) > 0) {
+                                len = Math.max(len, bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
                             }
                         }
-                        if (!bpd.getOptimum().isAuto()) {
-                            if (bpd.getOptimum().getLength().getValue() > 0) {
-                                len = Math.max(len, bpd.getOptimum().getLength().getValue());
+                        if (!bpd.getOptimum(getTableLM()).isAuto()) {
+                            if (bpd.getOptimum(getTableLM()).getLength().getValue(getTableLM()) > 0) {
+                                len = Math.max(len, bpd.getOptimum(getTableLM()).getLength().getValue(getTableLM()));
                             }
                         }
                         if (gridUnits[i].getRow() != null) {
                             bpd = gridUnits[i].getRow().getBlockProgressionDimension();
-                            if (!bpd.getMinimum().isAuto()) {
-                                if (bpd.getMinimum().getLength().getValue() > 0) {
-                                    len = Math.max(len, bpd.getMinimum().getLength().getValue());
+                            if (!bpd.getMinimum(getTableLM()).isAuto()) {
+                                if (bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()) > 0) {
+                                    len = Math.max(len, bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
                                 }
                             }
                         }
                     }
                     
+                    // Add the padding if any
+                    len += gridUnits[i].getBorders()
+                                    .getPaddingBefore(false, gridUnits[i].getCellLM());
+                    len += gridUnits[i].getBorders()
+                                    .getPaddingAfter(false, gridUnits[i].getCellLM());
+
                     //Now add the borders to the contentLength
                     if (isSeparateBorderModel()) {
                         len += gridUnits[i].getBorders().getBorderBeforeWidth(false);
                         len += gridUnits[i].getBorders().getBorderAfterWidth(false);
                     }
-                    len += gridUnits[i].getBorders().getPaddingBefore(false);
-                    len += gridUnits[i].getBorders().getPaddingAfter(false);
                     int startRow = Math.max(gridUnits[i].getStartRow(), firstRow[bt]);
                     Integer storedOffset = (Integer)rowOffsets[bt].get(new Integer(startRow));
                     int effYOffset;
@@ -906,7 +913,6 @@
             Block block = new Block();
             block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
             block.setPositioning(Block.ABSOLUTE);
-            TraitSetter.addBackground(block, row.getCommonBorderPaddingBackground());
             return block;
         }
     }
@@ -927,6 +933,7 @@
             rowBackground.setXOffset(this.startXOffset);
             rowBackground.setYOffset(yoffset);
             getTableLM().addChildArea(rowBackground);
+            TraitSetter.addBackground(rowBackground, row.getCommonBorderPaddingBackground(), getTableLM());
         }
     }
     
@@ -1125,4 +1132,13 @@
         }
     }
     
+    // --------- Property Resolution related functions --------- //
+    
+    /**
+     * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, fobj)
+     */
+    public int getBaseLength(int lengthBase, FObj fobj) {
+        return tableLM.getBaseLength(lengthBase, fobj);
+    }
+
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=265577&r1=265576&r2=265577&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 Wed Aug 31 13:29:33 2005
@@ -39,6 +39,8 @@
 
 import java.util.Iterator;
 import java.util.LinkedList;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.fo.FObj;
 
 /**
  * LayoutManager for a table FO.
@@ -58,13 +60,13 @@
     private Block curBlockArea;
 
     private int referenceIPD;
+    private int referenceBPD;
     private boolean autoLayout = true;
 
     //TODO space-before|after: handle space-resolution rules
     private MinOptMax spaceBefore;
     private MinOptMax spaceAfter;
     
-    
     /**
      * Create a new table layout manager.
      * @param node the table FO
@@ -73,7 +75,6 @@
         super(node);
         fobj = node;
         this.columns = new ColumnSetup(node);
-        initialize();
     }
 
     /** @return the table FO */
@@ -88,20 +89,20 @@
         return this.columns;
     }
     
-    private void initialize() {
-        spaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore).getSpace();
-        spaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter).getSpace();
+    public void initialize() {
+        spaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore, this).getSpace();
+        spaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter, this).getSpace();
         
         if (!fobj.isAutoLayout() 
-                && fobj.getInlineProgressionDimension().getOptimum().getEnum() != EN_AUTO) {
+                && fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
             autoLayout = false;
         }
     }
 
     private int getIPIndents() {
         int iIndents = 0;
-        iIndents += fobj.getCommonMarginBlock().startIndent.getValue();
-        iIndents += fobj.getCommonMarginBlock().endIndent.getValue();
+        iIndents += fobj.getCommonMarginBlock().startIndent.getValue(this);
+        iIndents += fobj.getCommonMarginBlock().endIndent.getValue(this);
         return iIndents;
     }
     
@@ -120,9 +121,11 @@
             }
         }
 
+        referenceBPD = context.getStackLimit().opt;
         referenceIPD = context.getRefIPD();
-        if (fobj.getInlineProgressionDimension().getOptimum().getEnum() != EN_AUTO) {
-            referenceIPD = fobj.getInlineProgressionDimension().getOptimum().getLength().getValue();
+
+        if (fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+            referenceIPD = fobj.getInlineProgressionDimension().getOptimum(this).getLength().getValue(this);
         } else if( !fobj.isAutoLayout() ) {
             log.info("table-layout=\"fixed\" and width=\"auto\", but auto-layout not supported " + 
                      "=> assuming width=\"100%\"");
@@ -141,11 +144,6 @@
             stackSize.add(spaceBefore);
         }
 
-        fobj.setLayoutDimension(PercentBase.BLOCK_IPD, referenceIPD);
-        fobj.setLayoutDimension(PercentBase.BLOCK_BPD, context.getStackLimit().opt);
-        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, referenceIPD);
-        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, context.getStackLimit().opt);
-
         // either works out table of column widths or if proportional-column-width function
         // is used works out total factor, so that value of single unit can be computed.
         int sumCols = 0;
@@ -153,7 +151,7 @@
         for (Iterator i = columns.iterator(); i.hasNext(); ) {
             TableColumn column = (TableColumn) i.next();
             Length width = column.getColumnWidth();
-            sumCols += width.getValue();
+            sumCols += width.getValue(this);
             if (width instanceof TableColLength) {
                 factors += ((TableColLength) width).getTableUnits();
             }
@@ -284,7 +282,7 @@
         addBlockSpacing(adjust, spaceBefore);
         spaceBefore = null;
 
-        int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue();
+        int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue(this);
         
         // add column, body then row areas
 
@@ -301,12 +299,15 @@
         curBlockArea.setBPD(tableHeight);
 
         if (fobj.isSeparateBorderModel()) {
-            TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+            TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
         }
-        TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+        TraitSetter.addBackground(curBlockArea, 
+                fobj.getCommonBorderPaddingBackground(),
+                this);
         TraitSetter.addMargins(curBlockArea,
                 fobj.getCommonBorderPaddingBackground(), 
-                fobj.getCommonMarginBlock());
+                fobj.getCommonMarginBlock(),
+                this);
         TraitSetter.addBreaks(curBlockArea, 
                 fobj.getBreakBefore(), fobj.getBreakAfter());
 
@@ -413,5 +414,41 @@
                 || !fobj.getKeepWithNext().getWithinColumn().isAuto();
     }
 
+    // --------- Property Resolution related functions --------- //
+
+    /**
+     * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, FObj)
+     */
+    public int getBaseLength(int lengthBase, FObj fobj) {
+        // Special handler for TableColumn width specifications
+        if (fobj instanceof TableColumn && fobj.getParent() == getFObj()) {
+            switch (lengthBase) {
+            case LengthBase.CONTAINING_BLOCK_WIDTH:
+                return getContentAreaIPD();
+            default:
+                log.error("Unknown base type for LengthBase.");
+                return 0;
+            }
+        } else {
+            return super.getBaseLength(lengthBase, fobj);
+        }
+    }
+    
+    /**
+     * Returns the IPD of the content area
+     * @return the IPD of the content area
+     */
+    public int getContentAreaIPD() {
+        return referenceIPD;
+    }
+   
+    /**
+     * Returns the BPD of the content area
+     * @return the BPD of the content area
+     */
+    public int getContentAreaBPD() {
+        return referenceBPD;
+    }
+    
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=265577&r1=265576&r2=265577&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 Wed Aug 31 13:29:33 2005
@@ -202,8 +202,8 @@
             } else {
                 borderBefore[column] = pgu.getBorders().getBorderBeforeWidth(false) / 2;
             }
-            paddingBefore[column] = pgu.getBorders().getPaddingBefore(false);
-            paddingAfter[column] = pgu.getBorders().getPaddingAfter(false);
+            paddingBefore[column] = pgu.getBorders().getPaddingBefore(false, pgu.getCellLM());
+            paddingAfter[column] = pgu.getBorders().getPaddingAfter(false, pgu.getCellLM());
             start[column] = 0;
             end[column] = -1;
             widths[column] = 0;
@@ -301,8 +301,8 @@
                     = getTableLM().getTable().getCommonBorderPaddingBackground(); 
                 effPenaltyLen += borders.getBorderBeforeWidth(false); 
                 effPenaltyLen += borders.getBorderAfterWidth(false); 
-                effPenaltyLen += borders.getPaddingBefore(false); 
-                effPenaltyLen += borders.getPaddingAfter(false); 
+                effPenaltyLen += borders.getPaddingBefore(false, getTableLM()); 
+                effPenaltyLen += borders.getPaddingAfter(false, getTableLM()); 
             }
             TableContentPosition tcpos = new TableContentPosition(getTableLM(), 
                     gridUnitParts, getActiveRow());

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java Wed Aug 31 13:29:33 2005
@@ -142,34 +142,34 @@
         //TODO Make this configurable
         if (reproduceMSWordBug) {
             //MS Word has a bug where padding left and top are exchanged
-            padding = border.getPaddingStart(false);
+            padding = border.getPaddingStart(false, null); // TODO do we need a real context here?
             if (padding != 0) {
                 attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_TOP, padding);
                 attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_TOP, 3 /*=twips*/);
             }
-            padding = border.getPaddingBefore(false);
+            padding = border.getPaddingBefore(false, null); // TODO do we need a real context here?
             if (padding != 0) {
                 attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_LEFT, padding);
                 attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_LEFT, 3 /*=twips*/);
             }
         } else {
-            padding = border.getPaddingStart(false);
+            padding = border.getPaddingStart(false, null); // TODO do we need a real context here?
             if (padding != 0) {
                 attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_LEFT, padding);
                 attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_LEFT, 3 /*=twips*/);
             }
-            padding = border.getPaddingBefore(false);
+            padding = border.getPaddingBefore(false, null); // TODO do we need a real context here?
             if (padding != 0) {
                 attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_TOP, padding);
                 attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_TOP, 3 /*=twips*/);
             }
         }
-        padding = border.getPaddingEnd(false);
+        padding = border.getPaddingEnd(false, null);  // TODO do we need a real context here?
         if (padding != 0) {
             attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_RIGHT, padding);
             attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_RIGHT, 3 /*=twips*/);
         }
-        padding = border.getPaddingAfter(false);
+        padding = border.getPaddingAfter(false, null); // TODO do we need a real context here?
         if (padding != 0) {
             attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_BOTTOM, padding);
             attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_BOTTOM, 3 /*=twips*/);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java Wed Aug 31 13:29:33 2005
@@ -186,9 +186,9 @@
 
     private static void attrBlockMargin(CommonMarginBlock cmb, FOPRtfAttributes rtfAttr) {
         rtfAttr.setTwips(RtfText.SPACE_BEFORE, 
-                cmb.spaceBefore.getOptimum().getLength());
+                cmb.spaceBefore.getOptimum(null).getLength());
         rtfAttr.setTwips(RtfText.SPACE_AFTER, 
-                cmb.spaceAfter.getOptimum().getLength());
+                cmb.spaceAfter.getOptimum(null).getLength());
         rtfAttr.setTwips(RtfText.LEFT_INDENT_BODY, cmb.marginLeft);
         rtfAttr.setTwips(RtfText.RIGHT_INDENT_BODY, cmb.marginRight);
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/traits/SpaceVal.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/traits/SpaceVal.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/traits/SpaceVal.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/traits/SpaceVal.java Wed Aug 31 13:29:33 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
  
 package org.apache.fop.traits;
 
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.fo.properties.SpaceProperty;
@@ -37,11 +38,12 @@
     /**
      * Constructor for SpaceVal objects based on Space objects.
      * @param spaceprop Space object to use
+     * @param context Percentage evaluation context
      */
-    public SpaceVal(SpaceProperty spaceprop) {
-        space = new MinOptMax(spaceprop.getMinimum().getLength().getValue(),
-                              spaceprop.getOptimum().getLength().getValue(),
-                              spaceprop.getMaximum().getLength().getValue());
+    public SpaceVal(SpaceProperty spaceprop, PercentBaseContext context) {
+        space = new MinOptMax(spaceprop.getMinimum(context).getLength().getValue(context),
+                              spaceprop.getOptimum(context).getLength().getValue(context),
+                              spaceprop.getMaximum(context).getLength().getValue(context));
         bConditional = 
                 (spaceprop.getConditionality().getEnum() == Constants.EN_DISCARD);
         Property precProp = spaceprop.getPrecedence();
@@ -69,7 +71,9 @@
         this.iPrecedence = iPrecedence;
     }
 
-    static public SpaceVal makeWordSpacing(Property wordSpacing, SpaceVal letterSpacing, Font fs) {
+    static public SpaceVal makeWordSpacing(Property wordSpacing, 
+                                           SpaceVal letterSpacing, 
+                                           Font fs) {
         if (wordSpacing.getEnum() == Constants.EN_NORMAL) {
             // give word spaces the possibility to shrink by a third,
             // and stretch by a half;
@@ -80,7 +84,7 @@
                      (space, MinOptMax.multiply(letterSpacing.getSpace(), 2)),
                      true, true, 0);
         } else {
-            return new SpaceVal(wordSpacing.getSpace());
+            return new SpaceVal(wordSpacing.getSpace(), null);
         }        
     }
 
@@ -89,7 +93,7 @@
             // letter spaces are set to zero (or use different values?)
             return new SpaceVal(new MinOptMax(0), true, true, 0);
         } else {
-            return new SpaceVal(letterSpacing.getSpace());
+            return new SpaceVal(letterSpacing.getSpace(), null);
         }
     }
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java Wed Aug 31 13:29:33 2005
@@ -118,6 +118,7 @@
                 final LayoutEngineTester tester, final File f) {
         suite.addTest(new LayoutEngineTestCase(f.getName()) {
             public void runTest() throws Exception {
+                org.apache.commons.logging.LogFactory.getLog(this.getClass()).info("Starting " + f.getName());
                 prepare(tester, f);
                 testMain();
             }

Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt Wed Aug 31 13:29:33 2005
@@ -1,16 +1,8 @@
-background-image-list1.xml
-background-image-list2.xml
+background-image6.xml
 background-image-table2.xml
-background-image-table3.xml
-background-image-table4.xml
 background-image-table5.xml
-background-image3.xml
-background-image5.xml
-background-image6.xml
-background-image7.xml
 block-container4a.xml
-external-graphic1.xml
-external-graphic2.xml
+font-stretch.xml
 external-graphic4.xml
 inline-block2.xml
 inline-container1.xml
@@ -19,11 +11,11 @@
 keep-with-previous3.xml
 keep-with-previous4.xml
 keep-with-previous5.xml
-leader-dots.xml
-leader-rule.xml
-leader-space.xml
+leader-alignment.xml
+leader-use-content.xml
 letter-spacing3.xml
 list4a.xml
+margin-region3.xml
 multi-column3.xml
 multi-column4.xml
 normal-breaking4.xml

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list1.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list1.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list1.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list1.xml Wed Aug 31 13:29:33 2005
@@ -18,14 +18,14 @@
 <testcase>
   <info>
     <p>
-      This test checks background image on lists (list-item).
+      This test checks background image on lists (list-block).
     </p>
   </info>
   <variables>
     <img>../../resources/images/bgimg300dpi.jpg</img>
   </variables>
   <fo>
-    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <fo:layout-master-set>
         <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
           <fo:region-body/>
@@ -33,7 +33,7 @@
       </fo:layout-master-set>
       <fo:page-sequence master-reference="normal" white-space-collapse="true">
         <fo:flow flow-name="xsl-region-body">
-          <fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+          <fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
             <fo:list-item>
               <fo:list-item-label end-indent="label-end()">
                 <fo:block>label 1</fo:block>
@@ -62,7 +62,7 @@
               <fo:list-item-label end-indent="label-end()">
                 <fo:block>label 3</fo:block>
               </fo:list-item-label>
-              <fo:list-item-body start-indent="body-start()" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+              <fo:list-item-body start-indent="body-start()">
                 <fo:block>
                   body 3: The whole list should have a centered background.
                   The whole list should have a centered background.
@@ -71,11 +71,13 @@
               </fo:list-item-body>
             </fo:list-item>
           </fo:list-block>
-          <fo:block></fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+    <eval expected="360000" xpath="//flow/block/@ipd"/>
+    <eval expected="172800" xpath="//flow/block/@bpd"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=63360" xpath="//flow/block/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list2.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-list2.xml Wed Aug 31 13:29:33 2005
@@ -25,7 +25,7 @@
     <img>../../resources/images/bgimg300dpi.jpg</img>
   </variables>
   <fo>
-    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <fo:layout-master-set>
         <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
           <fo:region-body/>
@@ -34,7 +34,7 @@
       <fo:page-sequence master-reference="normal" white-space-collapse="true">
         <fo:flow flow-name="xsl-region-body">
           <fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in">
-            <fo:list-item background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+            <fo:list-item background-repeat="no-repeat" background-color="yellow"  background-position-horizontal="center" background-position-vertical="center" background-image="##img">
               <fo:list-item-label end-indent="label-end()">
                 <fo:block>label 1</fo:block>
               </fo:list-item-label>
@@ -62,20 +62,22 @@
               <fo:list-item-label end-indent="label-end()">
                 <fo:block>label 3</fo:block>
               </fo:list-item-label>
-              <fo:list-item-body start-indent="body-start()" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+              <fo:list-item-body start-indent="body-start()">
                 <fo:block>
-                  body 3: The whole list should have a centered background.
-                  The whole list should have a centered background.
-                  The whole list should have a centered background.
+                  body 3: We should have no background on this list item.
+                  We should have no background on this list item.
+                  We should have no background on this list item.
                 </fo:block>
               </fo:list-item-body>
             </fo:list-item>
           </fo:list-block>
-          <fo:block></fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+    <eval expected="360000" xpath="//flow/block/block/@ipd"/>
+    <eval expected="72000" xpath="//flow/block/block/@bpd"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block/block/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table1.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table1.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table1.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table1.xml Wed Aug 31 13:29:33 2005
@@ -18,7 +18,7 @@
 <testcase>
   <info>
     <p>
-      This test checks background image on a table.
+      This test checks background image on a fo:table.
     </p>
   </info>
   <variables>
@@ -33,7 +33,7 @@
       </fo:layout-master-set>
       <fo:page-sequence master-reference="normal" white-space-collapse="true">
         <fo:flow flow-name="xsl-region-body">
-          <fo:table background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+          <fo:table background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
             <fo:table-column column-number="1" />
             <fo:table-column column-number="2" />
             <fo:table-column column-number="3" />
@@ -97,12 +97,12 @@
               </fo:table-row>
             </fo:table-body>
           </fo:table>
-          <fo:block>Table with centered background</fo:block>
+          <fo:block>Table with centered background image</fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
-    <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block[1]/@background"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block[1]/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table2.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table2.xml Wed Aug 31 13:29:33 2005
@@ -18,7 +18,7 @@
 <testcase>
   <info>
     <p>
-      This test checks background image on a table.
+      This test checks background image on a fo:table-body.
     </p>
   </info>
   <variables>
@@ -50,7 +50,7 @@
                 </fo:table-cell>
               </fo:table-row>
             </fo:table-header>
-            <fo:table-body background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+            <fo:table-body background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
               <fo:table-row>
                 <fo:table-cell>
                   <fo:block>Row 1 Col 1</fo:block>
@@ -97,11 +97,13 @@
               </fo:table-row>
             </fo:table-body>
           </fo:table>
-          <fo:block>Table with centered body background</fo:block>
+          <fo:block>Table with centered background image on body</fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+  <!-- backgrounds on table-body are not supported at the time this test
+  was written. Therefore no checks! -->
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table3.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table3.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table3.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table3.xml Wed Aug 31 13:29:33 2005
@@ -18,7 +18,7 @@
 <testcase>
   <info>
     <p>
-      This test checks background image on a table.
+      This test checks background image on a fo:table-row.
     </p>
   </info>
   <variables>
@@ -51,7 +51,7 @@
               </fo:table-row>
             </fo:table-header>
             <fo:table-body>
-              <fo:table-row background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+              <fo:table-row height="1in" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
                 <fo:table-cell>
                   <fo:block>Row 1 Col 1</fo:block>
                 </fo:table-cell>
@@ -73,35 +73,16 @@
                   <fo:block>Row 2 Col 3</fo:block>
                 </fo:table-cell>
               </fo:table-row>
-              <fo:table-row>
-                <fo:table-cell>
-                  <fo:block>Row 3 Col 1</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 3 Col 2</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 3 Col 3</fo:block>
-                </fo:table-cell>
-              </fo:table-row>
-              <fo:table-row>
-                <fo:table-cell>
-                  <fo:block>Row 4 Col 1</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 4 Col 2</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 4 Col 3</fo:block>
-                </fo:table-cell>
-              </fo:table-row>
             </fo:table-body>
           </fo:table>
-          <fo:block>Table with centered row 1 background</fo:block>
+          <fo:block>Table with centered background image on row 1</fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+    <eval expected="360000" xpath="//flow/block/block[4]/@ipd"/>
+    <eval expected="72000" xpath="//flow/block/block[4]/@bpd"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block/block[4]/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table4.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table4.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table4.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table4.xml Wed Aug 31 13:29:33 2005
@@ -18,7 +18,7 @@
 <testcase>
   <info>
     <p>
-      This test checks background image on a table.
+      This test checks background image on a fo:table-cell.
     </p>
   </info>
   <variables>
@@ -37,22 +37,9 @@
             <fo:table-column column-number="1" />
             <fo:table-column column-number="2" />
             <fo:table-column column-number="3" />
-            <fo:table-header>
-              <fo:table-row>
-                <fo:table-cell>
-                  <fo:block>Header Col 1</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Header Col 2</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Header Col 3</fo:block>
-                </fo:table-cell>
-              </fo:table-row>
-            </fo:table-header>
             <fo:table-body>
               <fo:table-row>
-                <fo:table-cell background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+                <fo:table-cell>
                   <fo:block>Row 1 Col 1</fo:block>
                 </fo:table-cell>
                 <fo:table-cell>
@@ -63,45 +50,42 @@
                 </fo:table-cell>
               </fo:table-row>
               <fo:table-row>
-                <fo:table-cell>
+                <fo:table-cell background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+                  <fo:block>Row 2 Col 1</fo:block>
+                  <fo:block>Row 2 Col 1</fo:block>
+                  <fo:block>Row 2 Col 1</fo:block>
+                  <fo:block>Row 2 Col 1</fo:block>
                   <fo:block>Row 2 Col 1</fo:block>
                 </fo:table-cell>
-                <fo:table-cell>
+                <fo:table-cell padding="5pt" display-align="center" background-color="blue" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
                   <fo:block>Row 2 Col 2</fo:block>
                 </fo:table-cell>
-                <fo:table-cell>
+                <fo:table-cell display-align="center" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
                   <fo:block>Row 2 Col 3</fo:block>
                 </fo:table-cell>
               </fo:table-row>
-              <fo:table-row>
-                <fo:table-cell>
-                  <fo:block>Row 3 Col 1</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 3 Col 2</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 3 Col 3</fo:block>
-                </fo:table-cell>
-              </fo:table-row>
-              <fo:table-row>
-                <fo:table-cell>
-                  <fo:block>Row 4 Col 1</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 4 Col 2</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 4 Col 3</fo:block>
-                </fo:table-cell>
-              </fo:table-row>
             </fo:table-body>
           </fo:table>
-          <fo:block>Table with centered row 1 col 1 background</fo:block>
+          <fo:block>Table with centered background images on row 2 col 1, and 3</fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+    <!-- first cell in row 2 -->
+    <eval expected="120000" xpath="//flow/block/block[4]/@ipd"/>
+    <eval expected="72000" xpath="//flow/block/block[4]/@bpd"/>
+    <eval expected="72000" xpath="//flow/block/block[4]/@bpda"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=36960,vertical=12960" xpath="//flow/block/block[4]/@background"/>
+    <!-- second cell in row 2 -->
+    <eval expected="110000" xpath="//flow/block/block[5]/@ipd"/>
+    <eval expected="62000" xpath="//flow/block/block[5]/@bpd"/>
+    <eval expected="72000" xpath="//flow/block/block[5]/@bpda"/>
+    <eval expected="color=#0000ff,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=36960,vertical=12960" xpath="//flow/block/block[5]/@background"/>
+    <!-- second cell in row 2 -->
+    <eval expected="120000" xpath="//flow/block/block[6]/@ipd"/>
+    <eval expected="72000" xpath="//flow/block/block[6]/@bpd"/>
+    <eval expected="72000" xpath="//flow/block/block[6]/@bpda"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=36960,vertical=12960" xpath="//flow/block/block[6]/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table5.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table5.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table5.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image-table5.xml Wed Aug 31 13:29:33 2005
@@ -18,7 +18,7 @@
 <testcase>
   <info>
     <p>
-      This test checks background image on a table.
+      This test checks background image on a fo:table-header and footer.
     </p>
   </info>
   <variables>
@@ -37,7 +37,7 @@
             <fo:table-column column-number="1" />
             <fo:table-column column-number="2" />
             <fo:table-column column-number="3" />
-            <fo:table-header background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+            <fo:table-header background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
               <fo:table-row>
                 <fo:table-cell>
                   <fo:block>Header Col 1</fo:block>
@@ -50,58 +50,51 @@
                 </fo:table-cell>
               </fo:table-row>
             </fo:table-header>
-            <fo:table-body>
+            <fo:table-footer background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
               <fo:table-row>
                 <fo:table-cell>
-                  <fo:block>Row 1 Col 1</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 1 Col 2</fo:block>
-                </fo:table-cell>
-                <fo:table-cell>
-                  <fo:block>Row 1 Col 3</fo:block>
-                </fo:table-cell>
-              </fo:table-row>
-              <fo:table-row>
-                <fo:table-cell>
-                  <fo:block>Row 2 Col 1</fo:block>
+                  <fo:block>Footer Col 1</fo:block>
                 </fo:table-cell>
                 <fo:table-cell>
-                  <fo:block>Row 2 Col 2</fo:block>
+                  <fo:block>Footer Col 2</fo:block>
                 </fo:table-cell>
                 <fo:table-cell>
-                  <fo:block>Row 2 Col 3</fo:block>
+                  <fo:block>Footer Col 3</fo:block>
                 </fo:table-cell>
               </fo:table-row>
-              <fo:table-row>
+            </fo:table-footer>
+            <fo:table-body background-color="blue">
+              <fo:table-row height="4in" background-color="blue">
                 <fo:table-cell>
-                  <fo:block>Row 3 Col 1</fo:block>
+                  <fo:block>Row 1 Col 1</fo:block>
                 </fo:table-cell>
                 <fo:table-cell>
-                  <fo:block>Row 3 Col 2</fo:block>
+                  <fo:block>Row 1 Col 2</fo:block>
                 </fo:table-cell>
                 <fo:table-cell>
-                  <fo:block>Row 3 Col 3</fo:block>
+                  <fo:block>Row 1 Col 3</fo:block>
                 </fo:table-cell>
               </fo:table-row>
-              <fo:table-row>
+              <fo:table-row height="4in" background-color="blue">
                 <fo:table-cell>
-                  <fo:block>Row 4 Col 1</fo:block>
+                  <fo:block>Row 2 Col 1</fo:block>
                 </fo:table-cell>
                 <fo:table-cell>
-                  <fo:block>Row 4 Col 2</fo:block>
+                  <fo:block>Row 2 Col 2</fo:block>
                 </fo:table-cell>
                 <fo:table-cell>
-                  <fo:block>Row 4 Col 3</fo:block>
+                  <fo:block>Row 2 Col 3</fo:block>
                 </fo:table-cell>
               </fo:table-row>
             </fo:table-body>
           </fo:table>
-          <fo:block>Table with centered header background</fo:block>
+          <fo:block>Table with centered background image in header and footer</fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+  <!-- backgrounds on table-header/footer are not supported at the time this test
+  was written. Therefore no checks! -->
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image2.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image2.xml Wed Aug 31 13:29:33 2005
@@ -18,7 +18,7 @@
 <testcase>
   <info>
     <p>
-      This test checks background images.
+      This test checks background images in block-containers.
     </p>
   </info>
   <variables>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image3.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image3.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image3.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image3.xml Wed Aug 31 13:29:33 2005
@@ -33,18 +33,19 @@
       </fo:layout-master-set>
       <fo:page-sequence master-reference="normal" white-space-collapse="true">
         <fo:flow flow-name="xsl-region-body">
-          <fo:block-container height="100%" width="100%" background-color="yellow">
-          <fo:block background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
-             normal block<fo:block/>
-             normal block
-          </fo:block>
+          <fo:block-container height="50%" width="50%" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+            <fo:block background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+              normal block<fo:block/>
+              normal block
+            </fo:block>
           </fo:block-container>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
-    <eval expected="color=#ffff00" xpath="//flow/block[1]/@background"/>
-    <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=136960,vertical=-8640" xpath="//flow/block[1]/block[1]/block[1]/@background"/>
+    <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=136960,vertical=136960" xpath="//regionViewport/@background"/>
+    <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=56960,vertical=56960" xpath="//flow/block[1]/@background"/>
+    <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=56960,vertical=-8640" xpath="//flow/block[1]/block[1]/block[1]/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image5.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image5.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image5.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image5.xml Wed Aug 31 13:29:33 2005
@@ -18,7 +18,7 @@
 <testcase>
   <info>
     <p>
-      This test checks background image on a fo:basic-link.
+      This test checks background image on a fo:inline.
     </p>
   </info>
   <variables>
@@ -34,12 +34,15 @@
       <fo:page-sequence master-reference="normal" white-space-collapse="true">
         <fo:flow flow-name="xsl-region-body">
           <fo:block>
-            Why is <fo:inline font-size="96pt" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img" background-color="lightgray">FOP</fo:inline> so cool?
+            Why is <fo:inline font-size="96pt" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">FOP</fo:inline> so cool?
           </fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+    <eval expected="197376" xpath="//flow/block/lineArea/inlineparent/@ipd"/>
+    <eval expected="92100" xpath="//flow/block/lineArea/inlineparent/@bpd"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=75648,vertical=23010" xpath="//flow/block/lineArea/inlineparent/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image7.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image7.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image7.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/background-image7.xml Wed Aug 31 13:29:33 2005
@@ -34,12 +34,15 @@
       <fo:page-sequence master-reference="normal" white-space-collapse="true">
         <fo:flow flow-name="xsl-region-body">
           <fo:block>
-            Why is <fo:basic-link external-destination="http://xmlgraphics.apache.org/fop" font-size="96pt" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">FOP</fo:basic-link> so cool?
+            Why is <fo:basic-link external-destination="http://xmlgraphics.apache.org/fop" font-size="96pt" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">FOP</fo:basic-link> so cool?
           </fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </fo>
   <checks>
+    <eval expected="197376" xpath="//flow/block/lineArea/inlineparent/@ipd"/>
+    <eval expected="92100" xpath="//flow/block/lineArea/inlineparent/@bpd"/>
+    <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=75648,vertical=23010" xpath="//flow/block/lineArea/inlineparent/@background"/>
   </checks>
 </testcase>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic1.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic1.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic1.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic1.xml Wed Aug 31 13:29:33 2005
@@ -41,7 +41,7 @@
   </fo>
   <checks>
     <eval expected="360000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@ipd"/>
-    <eval expected="50214" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
+    <eval expected="51864" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
     <eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipd"/>
     <eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipda"/>
     <eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@bpd"/>

Modified: xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic2.xml?rev=265577&r1=265576&r2=265577&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/external-graphic2.xml Wed Aug 31 13:29:33 2005
@@ -46,14 +46,14 @@
   <checks>
     <!-- first image -->
     <eval expected="360000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@ipd"/>
-    <eval expected="44134" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
+    <eval expected="45784" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
     <eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipd"/>
     <eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipda"/>
     <eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@bpd"/>
     <eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@bpda"/>
-    <!-- first image -->
+    <!-- second image -->
     <eval expected="360000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@ipd"/>
-    <eval expected="50214" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@bpd"/>
+    <eval expected="51864" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@bpd"/>
     <eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/lineArea/viewport/@ipd"/>
     <eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/lineArea/viewport/@ipda"/>
     <eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/lineArea/viewport/@bpd"/>



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