} else if (fobj instanceof org.apache.fop.fo.flow.BlockContainer) {
return ((org.apache.fop.fo.flow.BlockContainer)fobj)
.getCommonBorderPaddingBackground();
+ } else if (fobj instanceof org.apache.fop.fo.flow.ListBlock) {
+ return ((org.apache.fop.fo.flow.ListBlock)fobj)
+ .getCommonBorderPaddingBackground();
+ } else if (fobj instanceof org.apache.fop.fo.flow.ListItem) {
+ return ((org.apache.fop.fo.flow.ListItem)fobj)
+ .getCommonBorderPaddingBackground();
+ } else if (fobj instanceof org.apache.fop.fo.flow.Table) {
+ return ((org.apache.fop.fo.flow.Table)fobj)
+ .getCommonBorderPaddingBackground();
} else {
return null;
}
} else if (fobj instanceof org.apache.fop.fo.flow.ListItem) {
return ((org.apache.fop.fo.flow.ListItem)fobj)
.getCommonMarginBlock().spaceBefore;
+ } else if (fobj instanceof org.apache.fop.fo.flow.Table) {
+ return ((org.apache.fop.fo.flow.Table)fobj)
+ .getCommonMarginBlock().spaceBefore;
} else {
return null;
}
} else if (fobj instanceof org.apache.fop.fo.flow.ListItem) {
return ((org.apache.fop.fo.flow.ListItem)fobj)
.getCommonMarginBlock().spaceAfter;
+ } else if (fobj instanceof org.apache.fop.fo.flow.Table) {
+ return ((org.apache.fop.fo.flow.Table)fobj)
+ .getCommonMarginBlock().spaceAfter;
} else {
return null;
}
return false; //Does not really apply here
}
+ /** @see org.apache.fop.layoutmgr.ListElement#isPenalty() */
+ /*
+ public boolean isPenalty() {
+ return true; //not entirely true but a BreakElement will generate a penalty later
+ }*/
+
/** @return the penalty width */
public int getPenaltyWidth() {
return this.penaltyWidth;
return this.penaltyValue;
}
+ /**
+ * Sets the penalty value.
+ * @param p the new penalty value
+ */
+ public void setPenaltyValue(int p) {
+ this.penaltyValue = p;
+ }
+
/** @see org.apache.fop.layoutmgr.ListElement#isForcedBreak() */
public boolean isForcedBreak() {
return penaltyValue == -KnuthElement.INFINITE;
return breakClass;
}
+ /**
+ * Sets the break class.
+ * @param breakClass the new break class
+ */
+ public void setBreakClass(int breakClass) {
+ this.breakClass = breakClass;
+ }
+
/** @return the pending border and padding elements at the before edge */
public List getPendingBeforeMarks() {
return this.pendingBeforeMarks;
public static void removeLegalBreaks(LinkedList elements) {
ListIterator i = elements.listIterator();
while (i.hasNext()) {
- KnuthElement el = (KnuthElement)i.next();
+ ListElement el = (ListElement)i.next();
if (el.isPenalty()) {
- KnuthPenalty penalty = (KnuthPenalty)el;
+ BreakElement breakPoss = (BreakElement)el;
//Convert all penalties no break inhibitors
- if (penalty.getP() < KnuthPenalty.INFINITE) {
+ if (breakPoss.getPenaltyValue() < KnuthPenalty.INFINITE) {
+ breakPoss.setPenaltyValue(KnuthPenalty.INFINITE);
+ /*
i.set(new KnuthPenalty(penalty.getW(), KnuthPenalty.INFINITE,
penalty.isFlagged(), penalty.getPosition(), penalty.isAuxiliary()));
+ */
}
} else if (el.isGlue()) {
i.previous();
int count = end - start + 1;
int len = 0;
while (iter.hasNext()) {
- KnuthElement el = (KnuthElement)iter.next();
+ ListElement el = (ListElement)iter.next();
if (el.isBox()) {
- len += el.getW();
+ len += ((KnuthElement)el).getW();
} else if (el.isGlue()) {
- len += el.getW();
+ len += ((KnuthElement)el).getW();
} else {
//log.debug("Ignoring penalty: " + el);
//ignore penalties
return super.next();
}
- public KnuthElement getKE() {
- return (KnuthElement) peekNext();
+ public ListElement getKE() {
+ return (ListElement) peekNext();
}
protected LayoutManager getLM(Object nextObj) {
- return ((KnuthElement) nextObj).getLayoutManager();
+ return ((ListElement) nextObj).getLayoutManager();
}
protected Position getPos(Object nextObj) {
- return ((KnuthElement) nextObj).getPosition();
+ return ((ListElement) nextObj).getPosition();
}
}
}
iter.add(new KnuthPenalty(breakPoss.getPenaltyWidth(), breakPoss.getPenaltyValue(),
false, breakPoss.getBreakClass(),
- new SpaceHandlingBreakPosition(this), false));
+ new SpaceHandlingBreakPosition(this, breakPoss), false));
//if (glue2.isNonZero()) {
if (glue2w != 0 || glue2stretch != 0 || glue2shrink != 0) {
/*
public class SpaceHandlingBreakPosition extends Position {
private SpaceResolver resolver;
+ private Position originalPosition;
/**
* Main constructor.
* @param resolver the space resolver that provides the info about the actual situation
*/
- public SpaceHandlingBreakPosition(SpaceResolver resolver) {
+ public SpaceHandlingBreakPosition(SpaceResolver resolver, BreakElement breakPoss) {
super(null);
this.resolver = resolver;
+ this.originalPosition = breakPoss.getPosition();
+ //Unpack since the SpaceHandlingBreakPosition is a non-wrapped Position, too
+ while (this.originalPosition instanceof NonLeafPosition) {
+ this.originalPosition = this.originalPosition.getPosition();
+ }
}
/** @return the space resolver */
/** @see java.lang.Object#toString() */
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append("SpaceHandlingBreakPosition");
+ sb.append("SpaceHandlingBreakPosition(");
+ sb.append(this.originalPosition);
+ sb.append(")");
return sb.toString();
}
+
+ /**
+ * @return the original Position instance set at the BreakElement that this Position was
+ * created for.
+ */
+ public Position getOriginalBreakPosition() {
+ return this.originalPosition;
+ }
}
/**
import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.LengthRangeProperty;
+import org.apache.fop.layoutmgr.BreakElement;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.ElementListUtils;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.MinOptMaxUtil;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
if (rowFO != null && rowFO.getBreakBefore() != Constants.EN_AUTO) {
log.info("break-before found");
if (returnList.size() > 0) {
- KnuthElement last = (KnuthElement)returnList.getLast();
+ ListElement last = (ListElement)returnList.getLast();
if (last.isPenalty()) {
KnuthPenalty pen = (KnuthPenalty)last;
pen.setP(-KnuthPenalty.INFINITE);
pen.setBreakClass(rowFO.getBreakBefore());
+ } else if (last instanceof BreakElement) {
+ BreakElement breakPoss = (BreakElement)last;
+ breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
+ breakPoss.setBreakClass(rowFO.getBreakBefore());
}
} else {
if (!firstBreakBeforeServed) {
- returnList.add(new KnuthPenalty(0, -KnuthPenalty.INFINITE,
- false, rowFO.getBreakBefore(), new Position(getTableLM()), true));
+ //returnList.add(new KnuthPenalty(0, -KnuthPenalty.INFINITE,
+ // false, rowFO.getBreakBefore(), new Position(getTableLM()), true));
+ returnList.add(new BreakElement(new Position(getTableLM()),
+ 0, -KnuthPenalty.INFINITE, rowFO.getBreakBefore(), context));
iter.backToPreviousRow();
firstBreakBeforeServed = true;
break;
log.debug("child LM (row group) signals pending keep-with-previous");
if (returnList.size() > 0) {
//Modify last penalty
- KnuthElement last = (KnuthElement)returnList.getLast();
+ ListElement last = (ListElement)returnList.getLast();
if (last.isPenalty()) {
- KnuthPenalty pen = (KnuthPenalty)last;
+ BreakElement breakPoss = (BreakElement)last;
//Only honor keep if there's no forced break
- if (!pen.isForcedBreak()) {
- pen.setP(KnuthPenalty.INFINITE);
+ if (!breakPoss.isForcedBreak()) {
+ breakPoss.setPenaltyValue(KnuthPenalty.INFINITE);
}
}
}
if (rowFO != null && rowFO.getBreakAfter() != Constants.EN_AUTO) {
log.info("break-after found");
if (returnList.size() > 0) {
- KnuthElement last = (KnuthElement)returnList.getLast();
- if (last.isPenalty()) {
+ ListElement last = (ListElement)returnList.getLast();
+ if (last instanceof KnuthPenalty) {
KnuthPenalty pen = (KnuthPenalty)last;
pen.setP(-KnuthPenalty.INFINITE);
pen.setBreakClass(rowFO.getBreakAfter());
+ } else if (last instanceof BreakElement) {
+ BreakElement breakPoss = (BreakElement)last;
+ breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
+ breakPoss.setBreakClass(rowFO.getBreakAfter());
}
}
}
if (returnList.size() > 0) {
//Remove last penalty
- KnuthElement last = (KnuthElement)returnList.getLast();
- if (last.isPenalty()) {
- KnuthPenalty pen = (KnuthPenalty)last;
- if (!pen.isForcedBreak()) {
+ ListElement last = (ListElement)returnList.getLast();
+ if (last.isPenalty() || last instanceof BreakElement) {
+ if (!last.isForcedBreak()) {
//Only remove if we don't signal a forced break
returnList.removeLast();
}
ElementListObserver.observe(elems, "table-cell", primary.getCell().getId());
if ((elems.size() > 0)
- && ((KnuthElement)elems.getLast()).isPenalty()
- && ((KnuthPenalty)elems.getLast()).getP()
- == -KnuthElement.INFINITE) {
+ && ((KnuthElement)elems.getLast()).isForcedBreak()) {
// a descendant of this block has break-after
log.warn("Descendant of table-cell signals break: "
+ primary.getCellLM().isFinished());
List footerElements = null;
Position firstPos = null;
Position lastPos = null;
+ Position lastCheckPos = null;
while (parentIter.hasNext()) {
Position pos = (Position)parentIter.next();
- if (!(pos instanceof SpaceHandlingBreakPosition)) {
- if (firstPos == null) {
- firstPos = pos;
- }
- lastPos = pos;
+ if (pos instanceof SpaceHandlingBreakPosition) {
+ //This position has only been needed before addAreas was called, now we need the
+ //original one created by the layout manager.
+ pos = ((SpaceHandlingBreakPosition)pos).getOriginalBreakPosition();
+ }
+ if (pos == null) {
+ continue;
+ }
+ if (firstPos == null) {
+ firstPos = pos;
+ }
+ lastPos = pos;
+ if (pos.getIndex() >= 0) {
+ lastCheckPos = pos;
}
if (pos instanceof TableHeaderFooterPosition) {
TableHeaderFooterPosition thfpos = (TableHeaderFooterPosition)pos;
Map markers = getTableLM().getTable().getMarkers();
if (markers != null) {
getTableLM().getCurrentPV().addMarkers(markers,
- true, getTableLM().isFirst(firstPos), getTableLM().isLast(lastPos));
+ true, getTableLM().isFirst(firstPos), getTableLM().isLast(lastCheckPos));
}
if (headerElements != null) {
if (markers != null) {
getTableLM().getCurrentPV().addMarkers(markers,
- false, getTableLM().isFirst(firstPos), getTableLM().isLast(lastPos));
+ false, getTableLM().isFirst(firstPos), getTableLM().isLast(lastCheckPos));
}
}
import org.apache.fop.fo.properties.TableColLength;
import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
+import org.apache.fop.layoutmgr.ConditionalElementListener;
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.ListElement;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.layoutmgr.RelSide;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
* the render background.
*/
public class TableLayoutManager extends BlockStackingLayoutManager
- implements BlockLevelLayoutManager {
+ implements ConditionalElementListener {
+
private Table fobj;
private TableContentLayoutManager contentLM;
private MinOptMax spaceBefore;
private MinOptMax spaceAfter;
+ private boolean discardBorderBefore;
+ private boolean discardBorderAfter;
+ private boolean discardPaddingBefore;
+ private boolean discardPaddingAfter;
+ private MinOptMax effSpaceBefore;
+ private MinOptMax effSpaceAfter;
+
/**
* Create a new table layout manager.
* @param node the table FO
}
}
+ private void resetSpaces() {
+ this.discardBorderBefore = false;
+ this.discardBorderAfter = false;
+ this.discardPaddingBefore = false;
+ this.discardPaddingAfter = false;
+ this.effSpaceBefore = foSpaceBefore;
+ this.effSpaceAfter = foSpaceAfter;
+ }
+
private int getIPIndents() {
int iIndents = 0;
iIndents += fobj.getCommonMarginBlock().startIndent.getValue(this);
log.warn("Allocated IPD exceeds available reference IPD");
}
- MinOptMax stackSize = new MinOptMax();
+ //MinOptMax stackSize = new MinOptMax();
//Add spacing
+ /*
if (spaceAfter != null) {
stackSize.add(spaceAfter);
}
if (spaceBefore != null) {
stackSize.add(spaceBefore);
- }
+ }*/
// 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.
}
}
+ addKnuthElementsForSpaceBefore(returnList, alignment);
+
+ if (fobj.isSeparateBorderModel()) {
+ addKnuthElementsForBorderPaddingBefore(returnList);
+ }
+
+ //Spaces, border and padding to be repeated at each break
+ addPendingMarks(context);
+
LinkedList returnedList = null;
LinkedList contentList = new LinkedList();
//Position returnPosition = new NonLeafPosition(this, null);
//Body prevLM = null;
LayoutContext childLC = new LayoutContext(0);
+ /*
childLC.setStackLimit(
MinOptMax.subtract(context.getStackLimit(),
- stackSize));
+ stackSize));*/
childLC.setRefIPD(context.getRefIPD());
+ childLC.copyPendingMarksFrom(context);
if (contentLM == null) {
contentLM = new TableContentLayoutManager(this);
//Set index values on elements coming from the content LM
Iterator iter = returnedList.iterator();
while (iter.hasNext()) {
- KnuthElement el = (KnuthElement)iter.next();
+ ListElement el = (ListElement)iter.next();
notifyPos(el.getPosition());
}
log.debug(returnedList);
}
}
wrapPositionElements(contentList, returnList);
+ if (fobj.isSeparateBorderModel()) {
+ addKnuthElementsForBorderPaddingAfter(returnList);
+ }
+ addKnuthElementsForSpaceAfter(returnList, alignment);
addKnuthElementsForBreakAfter(returnList, context);
setFinished(true);
+ resetSpaces();
return returnList;
}
getPSLM().addIDToPage(fobj.getId());
// if adjusted space before
- double adjust = layoutContext.getSpaceAdjust();
- addBlockSpacing(adjust, spaceBefore);
- spaceBefore = null;
+ //double adjust = layoutContext.getSpaceAdjust();
+ //addBlockSpacing(adjust, spaceBefore);
+ //spaceBefore = null;
int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue(this);
curBlockArea.setBPD(tableHeight);
if (fobj.isSeparateBorderModel()) {
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
+ TraitSetter.addBorders(curBlockArea,
+ getTable().getCommonBorderPaddingBackground(),
+ discardBorderBefore, discardBorderAfter, false, false, this);
+ TraitSetter.addPadding(curBlockArea,
+ getTable().getCommonBorderPaddingBackground(),
+ discardPaddingBefore, discardPaddingAfter, false, false, this);
}
TraitSetter.addBackground(curBlockArea,
fobj.getCommonBorderPaddingBackground(),
this);
TraitSetter.addBreaks(curBlockArea,
fobj.getBreakBefore(), fobj.getBreakAfter());
+ TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(),
+ effSpaceBefore, effSpaceAfter);
flush();
// if adjusted space after
- addBlockSpacing(adjust, spaceAfter);
+ //addBlockSpacing(adjust, spaceAfter);
//bodyBreaks.clear();
+ resetSpaces();
curBlockArea = null;
}
}
}
- /**
- * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#negotiateBPDAdjustment(int, org.apache.fop.layoutmgr.KnuthElement)
- */
+ /** @see org.apache.fop.layoutmgr.BlockLevelLayoutManager */
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
// TODO Auto-generated method stub
return 0;
}
- /**
- * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#discardSpace(org.apache.fop.layoutmgr.KnuthGlue)
- */
+ /** @see org.apache.fop.layoutmgr.BlockLevelLayoutManager */
public void discardSpace(KnuthGlue spaceGlue) {
// TODO Auto-generated method stub
return referenceBPD;
}
+ /** @see org.apache.fop.layoutmgr.ConditionalElementListener */
+ public void notifySpace(RelSide side, MinOptMax effectiveLength) {
+ if (RelSide.BEFORE == side) {
+ if (log.isDebugEnabled()) {
+ log.debug(this + ": Space " + side + ", "
+ + this.effSpaceBefore + "-> " + effectiveLength);
+ }
+ this.effSpaceBefore = effectiveLength;
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug(this + ": Space " + side + ", "
+ + this.effSpaceAfter + "-> " + effectiveLength);
+ }
+ this.effSpaceAfter = effectiveLength;
+ }
+ }
+
+ /** @see org.apache.fop.layoutmgr.ConditionalElementListener */
+ public void notifyBorder(RelSide side, MinOptMax effectiveLength) {
+ if (effectiveLength == null) {
+ if (RelSide.BEFORE == side) {
+ this.discardBorderBefore = true;
+ } else {
+ this.discardBorderAfter = true;
+ }
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(this + ": Border " + side + " -> " + effectiveLength);
+ }
+ }
+
+ /** @see org.apache.fop.layoutmgr.ConditionalElementListener */
+ public void notifyPadding(RelSide side, MinOptMax effectiveLength) {
+ if (effectiveLength == null) {
+ if (RelSide.BEFORE == side) {
+ this.discardPaddingBefore = true;
+ } else {
+ this.discardPaddingAfter = true;
+ }
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(this + ": Padding " + side + " -> " + effectiveLength);
+ }
+ }
+
}
\ No newline at end of file
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
+import org.apache.fop.layoutmgr.BreakElement;
import org.apache.fop.layoutmgr.ElementListUtils;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthElement;
private void setupElementList(int column) {
GridUnit gu = getActiveGridUnit(column);
EffRow row = getActiveRow();
- if (gu.isEmpty()){
+ if (gu.isEmpty()) {
elementLists[column] = null;
start[column] = 0;
end[column] = -1;
//Create elements for step
int effPenaltyLen = penaltyLen;
- if (isSeparateBorderModel()) {
- CommonBorderPaddingBackground borders
- = getTableLM().getTable().getCommonBorderPaddingBackground();
- effPenaltyLen += borders.getBorderBeforeWidth(false);
- effPenaltyLen += borders.getBorderAfterWidth(false);
- effPenaltyLen += borders.getPaddingBefore(false, getTableLM());
- effPenaltyLen += borders.getPaddingAfter(false, getTableLM());
- }
TableContentPosition tcpos = new TableContentPosition(getTableLM(),
gridUnitParts, getActiveRow());
if (returnList.size() == 0) {
p = -KnuthPenalty.INFINITE; //Overrides any keeps (see 4.8 in XSL 1.0)
clearBreakCondition();
}
- returnList.add(new KnuthPenalty(effPenaltyLen, p, false, penaltyPos, false));
+ //returnList.add(new KnuthPenalty(effPenaltyLen, p, false, penaltyPos, false));
+ returnList.add(new BreakElement(penaltyPos, effPenaltyLen, p, 0, context));
log.debug("step=" + step + " (+" + increase + ")"
+ " box=" + boxLen
context.setFlags(LayoutContext.KEEP_WITH_NEXT_PENDING);
}
if (isBreakCondition()) {
- ((KnuthPenalty)returnList.getLast()).setP(-KnuthPenalty.INFINITE);
+ ((BreakElement)returnList.getLast()).setPenaltyValue(-KnuthPenalty.INFINITE);
}
lastTCPos.setFlag(TableContentPosition.LAST_IN_ROWGROUP, true);
return returnList;
block-container_space-before_space-after_3.xml
block_font-stretch.xml
block_padding_2.xml
-block_space-before_space-after_2.xml
-block_space-before_space-after_3.xml
block_word-spacing.xml
block_word-spacing_text-align_justify.xml
external-graphic_oversized.xml
<fo:block>line 2</fo:block>
</fo:block-container>
<fo:block>A block between block-containers.</fo:block>
- <fo:block-container background-color="yellow" id="page1-bc1">
+ <fo:block-container background-color="yellow" id="page1-bc2">
<!-- ATM, the block-container without height behaves like a block which is wrong. It generates a viewport/reference pair. -->
<fo:block space-before="1em">line 1</fo:block>
<fo:block>line 2</fo:block>
<testcase>
<info>
<p>
- This test checks lists. Checks for the presence of space-before and space-after on list-items.
+ This test checks spaces on tables.
</p>
</info>
<fo>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks border and padding conditionality on table.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="2in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" id="retain">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table table-layout="fixed" width="100%" border-collapse="separate" border-spacing="5pt"
+ padding-before="20pt" padding-before.conditionality="retain"
+ padding-after="20pt" padding-after.conditionality="retain"
+ border-before-style="solid" border-before-width="5pt" border-before-width.conditionality="retain"
+ border-after-style="solid" border-after-width="5pt" border-after-width.conditionality="retain">
+ <fo:table-column column-width="proportional-column-width(1)"/>
+ <fo:table-column column-width="proportional-column-width(9)"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell background-color="yellow">
+ <fo:block>cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell background-color="orange">
+ <fo:block text-align="justify">
+In olden times when wishing still helped one, there lived a king whose daughters
+were all beautiful; and the youngest was so beautiful that the sun itself, which
+has seen so much, was astonished whenever it shone in her face. Close by the king's
+castle lay a great dark forest, and under an old lime-tree in the forest was a well,
+and when the day was very warm, the king's child went out into the forest and sat
+down by the side of the cool fountain; and when she was bored she took a golden ball,
+and threw it up on high and caught it; and this ball was her favorite plaything.
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="normal" id="discard">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table table-layout="fixed" width="100%" border-collapse="separate" border-spacing="5pt"
+ padding-before="20pt" padding-before.conditionality="discard"
+ padding-after="20pt" padding-after.conditionality="discard"
+ border-before-style="solid" border-before-width="5pt" border-before-width.conditionality="discard"
+ border-after-style="solid" border-after-width="5pt" border-after-width.conditionality="discard">
+ <fo:table-column column-width="proportional-column-width(1)"/>
+ <fo:table-column column-width="proportional-column-width(9)"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell background-color="yellow">
+ <fo:block>cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell background-color="orange">
+ <fo:block text-align="justify">
+In olden times when wishing still helped one, there lived a king whose daughters
+were all beautiful; and the youngest was so beautiful that the sun itself, which
+has seen so much, was astonished whenever it shone in her face. Close by the king's
+castle lay a great dark forest, and under an old lime-tree in the forest was a well,
+and when the day was very warm, the king's child went out into the forest and sat
+down by the side of the cool fountain; and when she was bored she took a golden ball,
+and threw it up on high and caught it; and this ball was her favorite plaything.
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <element-list category="breaker" id="retain">
+ <box w="0"/> <!-- Helper box bearing the SpaceHandlingPosition and making sure the glue gets processed -->
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+
+ <box w="0"/>
+
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+ <penalty w="14400"/> <!-- p is not of interest here -->
+ <glue w="-50000"/>
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+
+ <box w="28800"/>
+
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-50000"/>
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+
+ <box w="14400"/>
+
+ <!-- skip three more lines -->
+ <skip>8</skip>
+ <skip>8</skip>
+ <skip>8</skip>
+ <skip>8</skip>
+ <skip>8</skip>
+
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-50000"/>
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+
+ <box w="28800"/> <!-- end of table -->
+
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+
+ <box w="0"/> <!-- This is used to make sure the preceding glue is not cut off -->
+
+ <skip>3</skip>
+ </element-list>
+ <element-list category="breaker" id="discard">
+ <box w="0"/> <!-- Helper box used to notify the LM for the addAreas stage about the discarded spaces -->
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+ <box w="0"/>
+ <penalty w="14400"/> <!-- p is not of interest here -->
+ <box w="28800"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="28800"/>
+
+ <box w="0"/> <!-- SpaceHandlingPosition-bearing helper box -->
+
+ <penalty w="0" p="INF"/>
+ <glue w="25000"/>
+ <box w="0"/> <!-- This is used to make sure the preceding glue is not cut off -->
+
+ <skip>3</skip>
+ </element-list>
+
+ <!-- retain case -->
+ <eval expected="(solid,#000000,5000)" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-before"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-before"/>
+
+ <eval expected="(solid,#000000,5000)" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-after"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-after"/>
+
+ <eval expected="(solid,#000000,5000)" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-before"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-before"/>
+
+ <eval expected="(solid,#000000,5000)" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-after"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-after"/>
+
+ <!-- discard case -->
+ <eval expected="(solid,#000000,5000)" xpath="//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-before"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-before"/>
+
+ <true xpath="not(boolean(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-after))"/>
+ <true xpath="not(boolean(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-after))"/>
+
+ <true xpath="not(boolean(//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-before))"/>
+ <true xpath="not(boolean(//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-before))"/>
+
+ <eval expected="(solid,#000000,5000)" xpath="//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@border-after"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@padding-after"/>
+ </checks>
+</testcase>
-->
<!-- $Id$ -->
<testcase>
- <info>
- <p>
+ <info>
+ <p>
This test checks basic tables. Tests table spaces and margins.
</p>
- </info>
- <fo>
- <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
- <fo:layout-master-set>
- <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
- <fo:region-body/>
- </fo:simple-page-master>
- </fo:layout-master-set>
- <fo:page-sequence master-reference="normal" white-space-collapse="true">
- <fo:flow flow-name="xsl-region-body">
- <fo:block background-color="orange">before table</fo:block>
- <fo:table table-layout="fixed" space-before="5pt" space-after="10pt" margin-left="5pt" margin-right="10pt" width="4in + 15pt" background-color="lightgray">
- <fo:table-column column-width="2in"/>
- <fo:table-column column-width="2in"/>
- <fo:table-body start-indent="0pt" end-indent="0pt">
- <fo:table-row>
- <fo:table-cell>
- <fo:block>cell1</fo:block>
- </fo:table-cell>
- <fo:table-cell background-color="yellow">
- <fo:block>cell2</fo:block>
- </fo:table-cell>
- </fo:table-row>
- <fo:table-row>
- <fo:table-cell background-color="orange">
- <fo:block text-align="end">cell3</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>cell4</fo:block>
- </fo:table-cell>
- </fo:table-row>
- </fo:table-body>
- </fo:table>
- <fo:block background-color="orange">after table</fo:block>
- <fo:block-container width="4in + 15pt">
- <fo:block space-before="5pt" space-after="10pt" margin-left="5pt" margin-right="10pt" background-color="lightgray">
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block background-color="orange">before table</fo:block>
+ <fo:table table-layout="fixed" space-before="5pt" space-after="10pt" margin-left="5pt" margin-right="10pt" width="4in + 15pt" background-color="lightgray">
+ <fo:table-column column-width="2in"/>
+ <fo:table-column column-width="2in"/>
+ <fo:table-body start-indent="0pt" end-indent="0pt">
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell background-color="yellow">
+ <fo:block>cell2</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <fo:table-row>
+ <fo:table-cell background-color="orange">
+ <fo:block text-align="end">cell3</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block>cell4</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:block background-color="orange">after table</fo:block>
+ <fo:block-container width="4in + 15pt">
+ <fo:block space-before="5pt" space-after="10pt" margin-left="5pt" margin-right="10pt" background-color="lightgray">
reference block
</fo:block>
- </fo:block-container>
- </fo:flow>
- </fo:page-sequence>
- </fo:root>
- </fo>
- <checks>
- <!-- spaces -->
- <eval expected="5000" xpath="//flow/block[2]/@bpd"/>
- <eval expected="10000" xpath="//flow/block[4]/@bpd"/>
- <!-- table dimensions -->
- <eval expected="303000" xpath="//flow/block[3]/@ipda"/>
- <eval expected="303000" xpath="//flow/block[3]/@ipd"/>
- <eval expected="28800" xpath="//flow/block[3]/@bpda"/>
- <eval expected="28800" xpath="//flow/block[3]/@bpd"/>
- <!-- cell 1 -->
- <true xpath="//flow/block[3]/block[1]/@is-reference-area"/>
- <eval expected="5000" xpath="//flow/block[3]/block[1]/@left-offset"/>
- <true xpath="not(boolean(//flow/block[3]/block[1]/@top-offset)) or (//flow/block[3]/block[1]/@top-offset = 0)"/>
- <eval expected="144000" xpath="//flow/block[3]/block[1]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[1]/@bpd"/>
- <eval expected="144000" xpath="//flow/block[3]/block[1]/block[1]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[1]/block[1]/@bpd"/>
- <eval expected="cell1" xpath="//flow/block[3]/block[1]/block[1]/lineArea"/>
- <!-- cell 2 -->
- <true xpath="//flow/block[3]/block[2]/@is-reference-area"/>
- <eval expected="149000" xpath="//flow/block[3]/block[2]/@left-offset"/>
- <true xpath="not(boolean(//flow/block[3]/block[2]/@top-offset)) or (//flow/block[3]/block[2]/@top-offset = 0)"/>
- <eval expected="144000" xpath="//flow/block[3]/block[2]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[2]/@bpd"/>
- <eval expected="144000" xpath="//flow/block[3]/block[2]/block[1]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[2]/block[1]/@bpd"/>
- <eval expected="cell2" xpath="//flow/block[3]/block[2]/block[1]/lineArea"/>
- <eval expected="color=#ffff00" xpath="//flow/block[3]/block[2]/@background"/>
- <!-- cell 3 -->
- <true xpath="//flow/block[3]/block[3]/@is-reference-area"/>
- <eval expected="5000" xpath="//flow/block[3]/block[3]/@left-offset"/>
- <eval expected="14400" xpath="//flow/block[3]/block[3]/@top-offset"/>
- <eval expected="144000" xpath="//flow/block[3]/block[3]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[3]/@bpd"/>
- <eval expected="144000" xpath="//flow/block[3]/block[3]/block[1]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[3]/block[1]/@bpd"/>
- <eval expected="cell3" xpath="//flow/block[3]/block[3]/block[1]/lineArea"/>
- <eval expected="color=#ffa500" xpath="//flow/block[3]/block[3]/@background"/>
- <!-- cell 4 -->
- <true xpath="//flow/block[3]/block[4]/@is-reference-area"/>
- <eval expected="149000" xpath="//flow/block[3]/block[4]/@left-offset"/>
- <eval expected="14400" xpath="//flow/block[3]/block[4]/@top-offset"/>
- <eval expected="144000" xpath="//flow/block[3]/block[4]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[4]/@bpd"/>
- <eval expected="144000" xpath="//flow/block[3]/block[4]/block[1]/@ipd"/>
- <eval expected="14400" xpath="//flow/block[3]/block[4]/block[1]/@bpd"/>
- <eval expected="cell4" xpath="//flow/block[3]/block[4]/block[1]/lineArea"/>
- </checks>
+ </fo:block-container>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- spaces -->
+ <eval expected="5000" xpath="//flow/block[2]/@space-before"/>
+ <eval expected="10000" xpath="//flow/block[2]/@space-after"/>
+ <!-- table dimensions -->
+ <eval expected="303000" xpath="//flow/block[2]/@ipda"/>
+ <eval expected="303000" xpath="//flow/block[2]/@ipd"/>
+ <eval expected="43800" xpath="//flow/block[2]/@bpda"/>
+ <eval expected="28800" xpath="//flow/block[2]/@bpd"/>
+ <!-- cell 1 -->
+ <true xpath="//flow/block[2]/block[1]/@is-reference-area"/>
+ <eval expected="5000" xpath="//flow/block[2]/block[1]/@left-offset"/>
+ <true xpath="not(boolean(//flow/block[2]/block[1]/@top-offset)) or (//flow/block[3]/block[1]/@top-offset = 0)"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[1]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[1]/@bpd"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[1]/block[1]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[1]/block[1]/@bpd"/>
+ <eval expected="cell1" xpath="//flow/block[2]/block[1]/block[1]/lineArea"/>
+ <!-- cell 2 -->
+ <true xpath="//flow/block[2]/block[2]/@is-reference-area"/>
+ <eval expected="149000" xpath="//flow/block[2]/block[2]/@left-offset"/>
+ <true xpath="not(boolean(//flow/block[2]/block[2]/@top-offset)) or (//flow/block[3]/block[2]/@top-offset = 0)"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[2]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[2]/@bpd"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[2]/block[1]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[2]/block[1]/@bpd"/>
+ <eval expected="cell2" xpath="//flow/block[2]/block[2]/block[1]/lineArea"/>
+ <eval expected="color=#ffff00" xpath="//flow/block[2]/block[2]/@background"/>
+ <!-- cell 3 -->
+ <true xpath="//flow/block[2]/block[3]/@is-reference-area"/>
+ <eval expected="5000" xpath="//flow/block[2]/block[3]/@left-offset"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[3]/@top-offset"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[3]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[3]/@bpd"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[3]/block[1]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[3]/block[1]/@bpd"/>
+ <eval expected="cell3" xpath="//flow/block[2]/block[3]/block[1]/lineArea"/>
+ <eval expected="color=#ffa500" xpath="//flow/block[2]/block[3]/@background"/>
+ <!-- cell 4 -->
+ <true xpath="//flow/block[2]/block[4]/@is-reference-area"/>
+ <eval expected="149000" xpath="//flow/block[2]/block[4]/@left-offset"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[4]/@top-offset"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[4]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[4]/@bpd"/>
+ <eval expected="144000" xpath="//flow/block[2]/block[4]/block[1]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/block[4]/block[1]/@bpd"/>
+ <eval expected="cell4" xpath="//flow/block[2]/block[4]/block[1]/lineArea"/>
+ </checks>
</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks space properties on table.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="1.8in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" id="retain">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table table-layout="fixed" width="100%" border-collapse="separate" space-before="20pt" space-before.conditionality="retain" space-after="10pt" space-after.conditionality="retain">
+ <fo:table-column column-width="proportional-column-width(1)"/>
+ <fo:table-column column-width="proportional-column-width(9)"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block text-align="justify">
+In olden times when wishing still helped one, there lived a king whose daughters
+were all beautiful; and the youngest was so beautiful that the sun itself, which
+has seen so much, was astonished whenever it shone in her face. Close by the king's
+castle lay a great dark forest, and under an old lime-tree in the forest was a well,
+and when the day was very warm, the king's child went out into the forest and sat
+down by the side of the cool fountain; and when she was bored she took a golden ball,
+and threw it up on high and caught it; and this ball was her favorite plaything.
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:block space-before.optimum="10pt" space-before.conditionality="retain" space-after="20pt" space-after.conditionality="retain">
+Two blocks, testing conditionality="retain".
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="normal" id="discard">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table table-layout="fixed" width="100%" border-collapse="separate" space-before="20pt" space-before.conditionality="discard" space-after="10pt" space-after.conditionality="discard">
+ <fo:table-column column-width="proportional-column-width(1)"/>
+ <fo:table-column column-width="proportional-column-width(9)"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block text-align="justify">
+In olden times when wishing still helped one, there lived a king whose daughters
+were all beautiful; and the youngest was so beautiful that the sun itself, which
+has seen so much, was astonished whenever it shone in her face. Close by the king's
+castle lay a great dark forest, and under an old lime-tree in the forest was a well,
+and when the day was very warm, the king's child went out into the forest and sat
+down by the side of the cool fountain; and when she was bored she took a golden ball,
+and threw it up on high and caught it; and this ball was her favorite plaything.
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:block space-before="10pt" space-before.conditionality="discard" space-after="20pt" space-after.conditionality="discard">
+Two blocks, testing conditionality="discard".
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <element-list category="breaker" id="retain">
+ <box w="0"/> <!-- Helper box bearing the SpaceHandlingPosition and making sure the glue gets processed -->
+ <penalty w="0" p="INF"/>
+ <glue w="20000"/>
+
+ <box w="0"/>
+
+ <penalty w="0" p="INF"/>
+ <glue w="10000"/>
+ <penalty w="14400"/> <!-- p is not of interest here -->
+ <glue w="-30000"/>
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="20000"/>
+
+ <box w="28800"/>
+
+ <penalty w="0" p="INF"/>
+ <glue w="10000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-30000"/>
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="20000"/>
+
+ <box w="14400"/>
+
+ <!-- skip three more lines -->
+ <skip>8</skip>
+ <skip>8</skip>
+ <skip>8</skip>
+ <skip>8</skip>
+ <skip>8</skip>
+
+ <penalty w="0" p="INF"/>
+ <glue w="10000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-30000"/>
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="20000"/>
+
+ <box w="28800"/> <!-- end of table -->
+
+ <penalty w="0" p="INF" aux="true"/>
+ <glue w="10000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-10000"/>
+
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="10000"/>
+
+ <box w="14400"/> <!-- second block -->
+
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="20000"/>
+
+ <box w="0"/> <!-- This is used to make sure the preceding glue is not cut off -->
+
+ <skip>3</skip>
+ </element-list>
+ <element-list category="breaker" id="discard">
+ <box w="0"/> <!-- Helper box used to notify the LM for the addAreas stage about the discarded spaces -->
+ <box w="0"/>
+ <penalty w="14400"/> <!-- p is not of interest here -->
+ <box w="28800"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="14400"/>
+ <penalty w="0" p="0"/>
+ <box w="28800"/>
+ <penalty w="0" p="0"/>
+ <glue w="10000"/>
+
+ <box w="14400"/> <!-- second block -->
+
+ <box w="0"/> <!-- SpaceHandlingPosition-bearing helper box -->
+
+ <box w="0"/> <!-- This is used to make sure the preceding glue is not cut off -->
+
+ <skip>3</skip>
+ </element-list>
+
+ <eval expected="4" xpath="count(//pageViewport)"/>
+
+ <!-- 1: retain -->
+ <eval expected="20000" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before"/>
+ <eval expected="10000" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-after"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before"/>
+ <!-- the following space is eliminated/collapsed through space resolution -->
+ <true xpath="not(boolean(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-after))"/>
+ <eval expected="10000" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[2]/@space-before"/>
+ <eval expected="20000" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[2]/@space-after"/>
+
+ <!-- 2: discard -->
+ <true xpath="not(boolean(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before))"/>
+ <true xpath="not(boolean(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before))"/>
+ <true xpath="not(boolean(//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before))"/>
+ <true xpath="not(boolean(//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-after))"/>
+ <eval expected="10000" xpath="//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[2]/@space-before"/>
+ <true xpath="not(boolean(//pageViewport[@nr=4]/page/regionViewport/regionBody/mainReference/span/flow/block[2]/@space-after))"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks space properties on table. Demonstrates that spaces are repeated on every generated area.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="30pt">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body" line-height="10pt" font-size="9pt">
+ <fo:table table-layout="fixed" width="100%" border-collapse="separate" space-before="5pt" space-before.conditionality="retain" background-color="yellow">
+ <fo:table-column column-width="proportional-column-width(1)"/>
+ <fo:table-column column-width="proportional-column-width(9)"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block>line 1</fo:block>
+ <fo:block>line 2</fo:block>
+ <fo:block>line 3</fo:block>
+ <fo:block>line 4</fo:block>
+ <fo:block>line 5</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <element-list category="breaker">
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="5000"/>
+ <box w="10000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-5000"/>
+
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="5000"/>
+ <box w="10000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-5000"/>
+
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="5000"/>
+ <box w="10000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-5000"/>
+
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="5000"/>
+ <box w="10000"/>
+ <penalty w="0" p="0"/>
+ <glue w="-5000"/>
+
+ <box w="0"/>
+ <penalty w="0" p="INF"/>
+ <glue w="5000"/>
+ <box w="10000"/>
+
+ <skip>3</skip>
+ </element-list>
+ <eval expected="3" xpath="count(//pageViewport)"/>
+ <eval expected="5000" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before"/>
+ <eval expected="5000" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before"/>
+ <eval expected="5000" xpath="//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-before"/>
+ <eval expected="1" xpath="count(//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
+ <eval expected="1" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
+ <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
+ <eval expected="2" xpath="count(//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[2]/block)"/>
+ <eval expected="2" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/block)"/>
+ <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block[1]/block)"/>
+
+ </checks>
+</testcase>
<eval expected="220000" xpath="//flow/block[1]/block[2]/@ipda"/>
<eval expected="220000" xpath="//flow/block[1]/block[2]/@ipd"/>
- <eval expected="10000" xpath="//flow/block[2]/@bpda"/> <!-- space-before -->
+ <eval expected="10000" xpath="//flow/block[2]/@space-before"/>
<!-- table 2 -->
- <eval expected="310000" xpath="//flow/block[3]/@ipda"/>
- <eval expected="300000" xpath="//flow/block[3]/@ipd"/>
- <eval expected="100000" xpath="//flow/block[3]/block[1]/@ipda"/>
- <eval expected="100000" xpath="//flow/block[3]/block[1]/@ipd"/>
- <eval expected="66666" xpath="//flow/block[3]/block[2]/@ipda"/>
- <eval expected="66666" xpath="//flow/block[3]/block[2]/@ipd"/>
- <eval expected="133333" xpath="//flow/block[3]/block[3]/@ipda"/>
- <eval expected="133333" xpath="//flow/block[3]/block[3]/@ipd"/>
+ <eval expected="310000" xpath="//flow/block[2]/@ipda"/>
+ <eval expected="300000" xpath="//flow/block[2]/@ipd"/>
+ <eval expected="100000" xpath="//flow/block[2]/block[1]/@ipda"/>
+ <eval expected="100000" xpath="//flow/block[2]/block[1]/@ipd"/>
+ <eval expected="66666" xpath="//flow/block[2]/block[2]/@ipda"/>
+ <eval expected="66666" xpath="//flow/block[2]/block[2]/@ipd"/>
+ <eval expected="133333" xpath="//flow/block[2]/block[3]/@ipda"/>
+ <eval expected="133333" xpath="//flow/block[2]/block[3]/@ipd"/>
</checks>
</testcase>