this.discardBorderAfter = false;
this.discardPaddingBefore = false;
this.discardPaddingAfter = false;
- this.effSpaceBefore = foSpaceBefore;
- this.effSpaceAfter = foSpaceAfter;
+ this.effSpaceBefore = null;
+ this.effSpaceAfter = null;
}
/** @return the content IPD */
LinkedList contentList = new LinkedList();
LinkedList returnList = new LinkedList();
- if (!bBreakBeforeServed) {
+ if (!breakBeforeServed) {
try {
if (addKnuthElementsForBreakBefore(returnList, context)) {
return returnList;
}
} finally {
- bBreakBeforeServed = true;
+ breakBeforeServed = true;
}
}
- addKnuthElementsForSpaceBefore(returnList, alignment);
+ if (!firstVisibleMarkServed) {
+ addKnuthElementsForSpaceBefore(returnList, alignment);
+ }
addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
firstVisibleMarkServed = true;
this.discardBorderAfter = false;
this.discardPaddingBefore = false;
this.discardPaddingAfter = false;
- this.effSpaceBefore = foSpaceBefore;
- this.effSpaceAfter = foSpaceAfter;
+ this.effSpaceBefore = null;
+ this.effSpaceAfter = null;
}
/**
/** Only used to store the original list when createUnitElements is called */
protected LinkedList storedList = null;
/** Indicates whether break before has been served or not */
- protected boolean bBreakBeforeServed = false;
+ protected boolean breakBeforeServed = false;
/** Indicates whether the first visible mark has been returned by this LM, yet */
protected boolean firstVisibleMarkServed = false;
/** Reference IPD available */
LinkedList contentList = new LinkedList();
LinkedList returnList = new LinkedList();
- if (!bBreakBeforeServed) {
+ if (!breakBeforeServed) {
try {
if (addKnuthElementsForBreakBefore(returnList, context)) {
return returnList;
}
} finally {
- bBreakBeforeServed = true;
+ breakBeforeServed = true;
}
}
- addKnuthElementsForSpaceBefore(returnList, alignment);
+ if (!firstVisibleMarkServed) {
+ addKnuthElementsForSpaceBefore(returnList, alignment);
+ }
addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
firstVisibleMarkServed = true;
// blocks
contentList.add(new BreakElement(
new Position(this), KnuthElement.INFINITE, context));
- /*
- contentList.add(new KnuthPenalty(0,
- KnuthElement.INFINITE, false,
- new Position(this), false));
- */
} else if (!((ListElement) contentList.getLast()).isGlue()) {
// add a null penalty to allow a break between blocks
contentList.add(new BreakElement(
new Position(this), 0, context));
- /*
- contentList.add(new KnuthPenalty(0, 0, false,
- new Position(this), false));*/
} else {
// the last element in contentList is a glue;
// it is a feasible breakpoint, there is no need to add
* @param context the layout context
*/
protected void addPendingMarks(LayoutContext context) {
- SpaceProperty spaceBefore = getSpaceBeforeProperty();
- if (spaceBefore != null
- && !(spaceBefore.getMinimum(this).getLength().getValue(this) == 0
- && spaceBefore.getMaximum(this).getLength().getValue(this) == 0)) {
- context.addPendingBeforeMark(new SpaceElement(getAuxiliaryPosition(), spaceBefore,
- RelSide.BEFORE,
- true, false, this));
- }
- SpaceProperty spaceAfter = getSpaceAfterProperty();
- if (spaceAfter != null
- && !(spaceAfter.getMinimum(this).getLength().getValue(this) == 0
- && spaceAfter.getMaximum(this).getLength().getValue(this) == 0)) {
- context.addPendingAfterMark(new SpaceElement(getAuxiliaryPosition(), spaceAfter,
- RelSide.AFTER,
- false, true, this));
- }
CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
if (borderAndPadding != null) {
if (borderAndPadding.getBorderBeforeWidth(false) > 0) {
this.discardBorderAfter = false;
this.discardPaddingBefore = false;
this.discardPaddingAfter = false;
- this.effSpaceBefore = foSpaceBefore;
- this.effSpaceAfter = foSpaceAfter;
+ this.effSpaceBefore = null;
+ this.effSpaceAfter = null;
}
/** @see org.apache.fop.layoutmgr.BlockStackingLayoutManager */
this.discardBorderAfter = false;
this.discardPaddingBefore = false;
this.discardPaddingAfter = false;
- this.effSpaceBefore = foSpaceBefore;
- this.effSpaceAfter = foSpaceAfter;
+ this.effSpaceBefore = null;
+ this.effSpaceAfter = null;
}
/** @see org.apache.fop.layoutmgr.LayoutManager */
this.discardBorderAfter = false;
this.discardPaddingBefore = false;
this.discardPaddingAfter = false;
- this.effSpaceBefore = foSpaceBefore;
- this.effSpaceAfter = foSpaceAfter;
+ this.effSpaceBefore = null;
+ this.effSpaceAfter = null;
}
/** @return half the value of border-separation.block-progression-dimension. */
LinkedList returnList = new LinkedList();
- if (!bBreakBeforeServed) {
+ if (!breakBeforeServed) {
try {
if (addKnuthElementsForBreakBefore(returnList, context)) {
return returnList;
}
} finally {
- bBreakBeforeServed = true;
+ breakBeforeServed = true;
}
}
}
}
- addKnuthElementsForSpaceBefore(returnList, alignment);
+ if (!firstVisibleMarkServed) {
+ addKnuthElementsForSpaceBefore(returnList, alignment);
+ }
if (getTable().isSeparateBorderModel()) {
addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="JM" type="fix">
+ Following a clarification by the XSL FO SG, space traits are only set on the
+ first and last area generated by an FO, and not on every area anymore.
+ </action>
<action context="Code" dev="JM" type="add">
New feature: "Intermediate format" (IF). The IF is basically the XML dialect
written by the area tree renderer (XMLRenderer). A new parser for this format
<description>Situation in a 4-column document where the column balancing doesn't work and even causes some
content to disappear.</description>
</testcase>
+ <testcase>
+ <name>Column Balancing problems</name>
+ <file>region-body_column-count_bug36356.xml</file>
+ <description>Column balancing doesn't work as expected.</description>
+ </testcase>
<testcase>
<name>No background-images on table-body</name>
<file>table-body_background-image.xml</file>
<box w="14400"/>
<box w="14400"/>
- <penalty w="0" p="INF"/>
- <glue w="10000" y="0" z="10000"/>
<penalty w="0" p="0"/>
- <glue w="-30000" y="0" z="-30000"/>
- <box w="0"/>
- <penalty w="0" p="INF"/>
- <glue w="20000" y="0" z="20000"/>
<box w="14400"/>
- <penalty w="0" p="INF"/>
- <glue w="10000" y="0" z="10000"/>
<penalty w="0" p="0"/>
- <glue w="-30000" y="0" z="-30000"/>
- <box w="0"/>
- <penalty w="0" p="INF"/>
- <glue w="20000" y="0" z="20000"/>
<box w="14400"/>
<!-- skip three more lines -->
- <skip>8</skip>
- <skip>8</skip>
- <skip>8</skip>
+ <skip>2</skip>
+ <skip>2</skip>
+ <skip>2</skip>
- <penalty w="0" p="INF"/>
- <glue w="10000" y="0" z="10000"/>
<penalty w="0" p="0"/>
- <glue w="-30000" y="0" z="-30000"/>
- <box w="0"/>
- <penalty w="0" p="INF"/>
- <glue w="20000" y="0" z="20000"/>
<box w="14400"/>
<box w="14400"/>
<testcase>
<info>
<p>
- This test checks block-level space properties. Demonstrates that spaces are repeated on every generated area.
+ This test checks block-level space properties. Demonstrates that spaces are only on the first (or last) 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:simple-page-master master-name="normal" page-width="5in" page-height="28pt">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<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"/>
+ <true xpath="not(boolean(//pageViewport[@nr=2]/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))"/>
<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)"/>
<box w="14400"/>
<box w="14400"/>
- <penalty w="0" p="INF"/>
- <glue w="10000" y="0" z="10000"/>
<penalty w="0" p="0"/>
- <glue w="-30000" y="0" z="-30000"/>
- <box w="0"/>
- <penalty w="0" p="INF"/>
- <glue w="20000" y="0" z="20000"/>
<box w="14400"/>
- <penalty w="0" p="INF"/>
- <glue w="10000" y="0" z="10000"/>
<penalty w="0" p="0"/>
- <glue w="-30000" y="0" z="-30000"/>
- <box w="0"/>
- <penalty w="0" p="INF"/>
- <glue w="20000" y="0" z="20000"/>
<box w="14400"/>
<!-- skip three more lines -->
- <skip>8</skip>
- <skip>8</skip>
- <skip>8</skip>
+ <skip>2</skip>
+ <skip>2</skip>
+ <skip>2</skip>
- <penalty w="0" p="INF"/>
- <glue w="10000" y="0" z="10000"/>
<penalty w="0" p="0"/>
- <glue w="-30000" y="0" z="-30000"/>
- <box w="0"/>
- <penalty w="0" p="INF"/>
- <glue w="20000" y="0" z="20000"/>
<box w="14400"/>
<box w="14400"/>
<testcase>
<info>
<p>
- This test checks block-level space properties. Demonstrates that spaces are repeated on every generated area.
+ This test checks block-level space properties. Demonstrates that space-before is only on the first 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:simple-page-master master-name="normal" page-width="5in" page-height="28pt">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<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"/>
<!-- skip two more lines -->
- <skip>6</skip>
- <skip>6</skip>
+ <skip>2</skip>
+ <skip>2</skip>
- <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"/>
+ <true xpath="not(boolean(//pageViewport[@nr=2]/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))"/>
<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)"/>
<penalty w="0" p="0"/>
- <glue w="-10000"/>
-
- <box w="0"/>
- <penalty w="0" p="INF"/>
- <glue w="10000"/>
-
<box w="14400"/>
<skip>3</skip>
<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"/>
- <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>2</skip>
+ <skip>2</skip>
+ <skip>2</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 first list item -->
- <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"/> <!-- second list-item -->
<!-- 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"/>
+ <true xpath="not(boolean(//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-after))"/>
+ <true xpath="not(boolean(//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"/>
<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>
+ <skip>2</skip>
+ <skip>2</skip>
+ <skip>2</skip>
+ <skip>2</skip>
+ <skip>2</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 -->
<!-- 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"/>
+ <true xpath="not(boolean(//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/@space-after))"/>
+ <true xpath="not(boolean(//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"/>
<testcase>
<info>
<p>
- This test checks space properties on table. Demonstrates that spaces are repeated on every generated area.
+ This test checks space properties on table. Demonstrates that spaces are only on the first (or last) 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:simple-page-master master-name="normal" page-width="5in" page-height="28pt">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<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"/>
+ <true xpath="not(boolean(//pageViewport[@nr=2]/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))"/>
<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)"/>