From 337db3fff0e15c4d90e5549e2a403acc67d24da3 Mon Sep 17 00:00:00 2001 From: Chris Bowditch Date: Thu, 20 May 2004 08:11:31 +0000 Subject: [PATCH] fixed problem with top/bottom borders on regular blocks git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197611 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/BlockLayoutManager.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 2d2e287fc..f2339c519 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -1,12 +1,12 @@ /* * Copyright 1999-2004 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -/* $Id$ */ +/* $Id: BlockLayoutManager.java,v 1.17 2004/05/15 21:51:59 gmazza Exp $ */ package org.apache.fop.layoutmgr; @@ -49,9 +49,9 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { private CommonMarginBlock marginProps; /* holds the (one-time use) fo:block space-before - and -after properties. Large fo:blocks are split + and -after properties. Large fo:blocks are split into multiple Area.Blocks to accomodate the subsequent - regions (pages) they are placed on. space-before + 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. @@ -156,7 +156,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { LayoutManager curLM; // currently active LM int ipd = context.getRefIPD(); - int iIndents = marginProps.startIndent + marginProps.endIndent; + int iIndents = marginProps.startIndent + marginProps.endIndent; int bIndents = borderProps.getBPPaddingAndBorder(false); ipd -= iIndents; @@ -178,7 +178,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { // Set context for percentage property values. fobj.setLayoutDimension(PercentBase.BLOCK_IPD, ipd); fobj.setLayoutDimension(PercentBase.BLOCK_BPD, -1); - + while ((curLM = getChildLM()) != null) { // Make break positions and return blocks! // Set up a LayoutContext @@ -260,7 +260,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { double adjust = layoutContext.getSpaceAdjust(); addBlockSpacing(adjust, foBlockSpaceBefore); foBlockSpaceBefore = null; - + addID(); addMarkers(true, true); @@ -323,13 +323,17 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { // Get reference IPD from parentArea int referenceIPD = parentArea.getIPD(); curBlockArea.setIPD(referenceIPD); - + // Set the width of the block based on the parent block + // Need to be careful though, if parent is BC then width may not be set + int parentwidth = 0; if (parentArea instanceof BlockParent) { - curBlockArea.setWidth(((BlockParent) parentArea).getWidth()); - } else { - curBlockArea.setWidth(referenceIPD); + parentwidth = ((BlockParent) parentArea).getWidth(); + } + if (parentwidth == 0) { + parentwidth = referenceIPD; } + curBlockArea.setWidth(parentwidth); setCurrentArea(curBlockArea); // ??? for generic operations } return curBlockArea; -- 2.39.5