aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java25
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java3
2 files changed, 24 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 0681fdb27..bc82ca467 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -76,6 +76,17 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
private CommonBorderAndPadding borderProps;
private CommonBackground backgroundProps;
+ /* holds the (one-time use) fo:block space-before
+ and -after properties. Large fo:blocks are split
+ into multiple Area.Blocks to accomodate the subsequent
+ regions (pages) they are placed on. space-before
+ is applied at the beginning of the first
+ Block and space-after at the end of the last Block
+ used in rendering the fo:block.
+ */
+ private MinOptMax foBlockSpaceBefore = null;
+ private MinOptMax foBlockSpaceAfter = null; // not currently implemented
+
private int lead = 12000;
private int lineHeight = 14000;
private int follow = 2000;
@@ -169,6 +180,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
layoutProps = pm.getLayoutProps();
borderProps = pm.getBorderAndPadding();
backgroundProps = pm.getBackgroundProps();
+ foBlockSpaceBefore = layoutProps.spaceBefore.getSpace();
}
public BreakPoss getNextBreakPoss(LayoutContext context) {
@@ -177,9 +189,13 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
int ipd = context.getRefIPD();
MinOptMax stackSize = new MinOptMax();
- // if starting add space before
- stackSize.add(layoutProps.spaceBefore.getSpace());
+ if (foBlockSpaceBefore != null) {
+ // this function called before addAreas(), so
+ // setting foBlockSpaceBefore = null *in* addAreas()
+ stackSize.add(foBlockSpaceBefore);
+ }
+
BreakPoss lastPos = null;
while ((curLM = getChildLM()) != null) {
@@ -261,8 +277,9 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
// if adjusted space before
double adjust = layoutContext.getSpaceAdjust();
- addBlockSpacing(adjust, layoutProps.spaceBefore.getSpace());
-
+ addBlockSpacing(adjust, foBlockSpaceBefore);
+ foBlockSpaceBefore = null;
+
addID();
addMarkers(true, true);
diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index d712b52f0..3eb468492 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -106,6 +106,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
* @param minoptmax the min/opt/max value of the spacing
*/
public void addBlockSpacing(double adjust, MinOptMax minoptmax) {
+ if (minoptmax == null) {
+ return;
+ }
int sp = minoptmax.opt;
if (adjust > 0) {
sp = sp + (int)(adjust * (minoptmax.max - minoptmax.opt));