From 4a34763794b0293bbcf74a08f34d0035aeff61fe Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 19 Jan 2006 15:10:14 +0000 Subject: [PATCH] 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. For details, see: http://wiki.apache.org/xmlgraphics-fop/XslFoSpecificationUncertainties/SpaceTraits Note: this change brings another issue in column balancing to light. That's the reason for disabling one of the tests. I wasn't able to find a quick fix there. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@370494 13f79535-47bb-0310-9956-ffa450edef68 --- .../BlockContainerLayoutManager.java | 12 ++++--- .../fop/layoutmgr/BlockLayoutManager.java | 4 +-- .../layoutmgr/BlockStackingLayoutManager.java | 34 ++++--------------- .../list/ListBlockLayoutManager.java | 4 +-- .../layoutmgr/list/ListItemLayoutManager.java | 4 +-- .../layoutmgr/table/TableLayoutManager.java | 12 ++++--- status.xml | 4 +++ test/layoutengine/disabled-testcases.xml | 5 +++ ...k-container_space-before_space-after_1.xml | 24 ++----------- ...k-container_space-before_space-after_2.xml | 29 +++------------- .../block_space-before_space-after_2.xml | 24 ++----------- .../block_space-before_space-after_4.xml | 20 ++++------- .../block_space-before_space-after_6.xml | 6 ---- .../list-block_space-before_space-after_1.xml | 34 +++---------------- .../table_space-before_space-after_1.xml | 32 ++++------------- .../table_space-before_space-after_2.xml | 29 +++------------- 16 files changed, 69 insertions(+), 208 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 455a7d8fc..658a92e0d 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -129,8 +129,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager 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 */ @@ -241,17 +241,19 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager 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; diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 0db92b30f..a303f18fd 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -110,8 +110,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager this.discardBorderAfter = false; this.discardPaddingBefore = false; this.discardPaddingAfter = false; - this.effSpaceBefore = foSpaceBefore; - this.effSpaceAfter = foSpaceAfter; + this.effSpaceBefore = null; + this.effSpaceAfter = null; } /** diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index c09ae8ae5..eb7a2599c 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -55,7 +55,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager /** 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 */ @@ -235,17 +235,19 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager 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; @@ -316,18 +318,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager // 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 @@ -763,22 +757,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager * @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) { diff --git a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index dcedfdbcb..e23639e0d 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java @@ -109,8 +109,8 @@ public class ListBlockLayoutManager extends 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.BlockStackingLayoutManager */ diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index 2dd7020a7..c402f37ae 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -168,8 +168,8 @@ public class ListItemLayoutManager extends 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 */ diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 5bfab332e..9aea85080 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -126,8 +126,8 @@ public class TableLayoutManager extends BlockStackingLayoutManager 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. */ @@ -145,13 +145,13 @@ public class TableLayoutManager extends BlockStackingLayoutManager LinkedList returnList = new LinkedList(); - if (!bBreakBeforeServed) { + if (!breakBeforeServed) { try { if (addKnuthElementsForBreakBefore(returnList, context)) { return returnList; } } finally { - bBreakBeforeServed = true; + breakBeforeServed = true; } } @@ -202,7 +202,9 @@ public class TableLayoutManager extends BlockStackingLayoutManager } } - addKnuthElementsForSpaceBefore(returnList, alignment); + if (!firstVisibleMarkServed) { + addKnuthElementsForSpaceBefore(returnList, alignment); + } if (getTable().isSeparateBorderModel()) { addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed); diff --git a/status.xml b/status.xml index 37d891f97..612d116f6 100644 --- a/status.xml +++ b/status.xml @@ -27,6 +27,10 @@ + + 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. + 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 diff --git a/test/layoutengine/disabled-testcases.xml b/test/layoutengine/disabled-testcases.xml index 684e5c4c1..78ef2a7eb 100755 --- a/test/layoutengine/disabled-testcases.xml +++ b/test/layoutengine/disabled-testcases.xml @@ -259,6 +259,11 @@ Situation in a 4-column document where the column balancing doesn't work and even causes some content to disappear. + + Column Balancing problems + region-body_column-count_bug36356.xml + Column balancing doesn't work as expected. + No background-images on table-body table-body_background-image.xml diff --git a/test/layoutengine/standard-testcases/block-container_space-before_space-after_1.xml b/test/layoutengine/standard-testcases/block-container_space-before_space-after_1.xml index 37b7b87c2..5397d516e 100644 --- a/test/layoutengine/standard-testcases/block-container_space-before_space-after_1.xml +++ b/test/layoutengine/standard-testcases/block-container_space-before_space-after_1.xml @@ -75,38 +75,20 @@ Two blocks, testing conditionality="discard". - - - - - - - - - - - - - 8 - 8 - 8 + 2 + 2 + 2 - - - - - - diff --git a/test/layoutengine/standard-testcases/block-container_space-before_space-after_2.xml b/test/layoutengine/standard-testcases/block-container_space-before_space-after_2.xml index d742b3e85..8ed83492e 100644 --- a/test/layoutengine/standard-testcases/block-container_space-before_space-after_2.xml +++ b/test/layoutengine/standard-testcases/block-container_space-before_space-after_2.xml @@ -18,13 +18,13 @@

- 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.

- + @@ -46,42 +46,23 @@ + - - - - - - - - - - - - - - - - - - - - 3 - - + + diff --git a/test/layoutengine/standard-testcases/block_space-before_space-after_2.xml b/test/layoutengine/standard-testcases/block_space-before_space-after_2.xml index 0676277f9..4b2d67212 100644 --- a/test/layoutengine/standard-testcases/block_space-before_space-after_2.xml +++ b/test/layoutengine/standard-testcases/block_space-before_space-after_2.xml @@ -71,38 +71,20 @@ Two blocks, testing conditionality="discard". - - - - - - - - - - - - - 8 - 8 - 8 + 2 + 2 + 2 - - - - - - diff --git a/test/layoutengine/standard-testcases/block_space-before_space-after_4.xml b/test/layoutengine/standard-testcases/block_space-before_space-after_4.xml index 3d4fb9f58..d00e18cb4 100644 --- a/test/layoutengine/standard-testcases/block_space-before_space-after_4.xml +++ b/test/layoutengine/standard-testcases/block_space-before_space-after_4.xml @@ -18,13 +18,13 @@

- 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.

- + @@ -48,30 +48,22 @@ - - - - - - 6 - 6 + 2 + 2 - - - 3 - - + + diff --git a/test/layoutengine/standard-testcases/block_space-before_space-after_6.xml b/test/layoutengine/standard-testcases/block_space-before_space-after_6.xml index 7b6737252..b21963bed 100644 --- a/test/layoutengine/standard-testcases/block_space-before_space-after_6.xml +++ b/test/layoutengine/standard-testcases/block_space-before_space-after_6.xml @@ -78,12 +78,6 @@ - - - - - - 3 diff --git a/test/layoutengine/standard-testcases/list-block_space-before_space-after_1.xml b/test/layoutengine/standard-testcases/list-block_space-before_space-after_1.xml index 82af9d20d..2219cdfa1 100644 --- a/test/layoutengine/standard-testcases/list-block_space-before_space-after_1.xml +++ b/test/layoutengine/standard-testcases/list-block_space-before_space-after_1.xml @@ -108,48 +108,24 @@ Two blocks, testing conditionality="discard". - - - - - - - - - - - - - 8 - 8 - 8 + 2 + 2 + 2 - - - - - - - - - - - - @@ -203,8 +179,8 @@ Two blocks, testing conditionality="discard". - - + + diff --git a/test/layoutengine/standard-testcases/table_space-before_space-after_1.xml b/test/layoutengine/standard-testcases/table_space-before_space-after_1.xml index 430d8689a..c151d293f 100644 --- a/test/layoutengine/standard-testcases/table_space-before_space-after_1.xml +++ b/test/layoutengine/standard-testcases/table_space-before_space-after_1.xml @@ -96,40 +96,22 @@ Two blocks, testing conditionality="discard". - - - - - - - - - - - - - 8 - 8 - 8 - 8 - 8 + 2 + 2 + 2 + 2 + 2 - - - - - - @@ -185,8 +167,8 @@ Two blocks, testing conditionality="discard". - - + + diff --git a/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml b/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml index 2e136a5cd..5b889b538 100644 --- a/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml +++ b/test/layoutengine/standard-testcases/table_space-before_space-after_2.xml @@ -18,13 +18,13 @@

- 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.

- + @@ -57,42 +57,23 @@ + - - - - - - - - - - - - - - - - - - - - 3 - - + + -- 2.39.5