From 448befc115b005dc2a07391182179c686a91d25f Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 6 Feb 2008 14:07:03 +0000 Subject: Bugzilla #36391: Fixed problem with positioning of content when reference-orientation="180" is used. CTM is now correct. It is updated after the height of the content is known. Instead of somehow inverting the element list, I've simply declared this case non-breakable, i.e. I generate one box. Fixed a few other problems mostly occurring when rotating block-container content by 90 or 270 degrees plus a few remaining auto-height handling problems. This involved switching off some sometimes unwanted side-effects from auto-updating the BPD in some area classes. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@618992 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/Block.java | 15 ++++++++++++--- src/java/org/apache/fop/area/BlockViewport.java | 9 +++++++++ src/java/org/apache/fop/area/NormalFlow.java | 4 +++- 3 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src/java/org/apache/fop/area') diff --git a/src/java/org/apache/fop/area/Block.java b/src/java/org/apache/fop/area/Block.java index 264a9e690..21fa7c49d 100644 --- a/src/java/org/apache/fop/area/Block.java +++ b/src/java/org/apache/fop/area/Block.java @@ -19,7 +19,6 @@ package org.apache.fop.area; -import java.util.ArrayList; // block areas hold either more block areas or line // areas can also be used as a block spacer @@ -59,6 +58,8 @@ public class Block extends BlockParent { private int stacking = TB; private int positioning = STACK; + protected transient boolean allowBPDUpdate = true; + // a block with may contain the dominant styling info in // terms of most lines or blocks with info @@ -78,7 +79,7 @@ public class Block extends BlockParent { * @param autoHeight increase the height of the block. */ public void addBlock(Block block, boolean autoHeight) { - if (autoHeight) { + if (autoHeight && allowBPDUpdate) { bpd += block.getAllocBPD(); } addChildArea(block); @@ -112,6 +113,14 @@ public class Block extends BlockParent { return positioning; } + /** + * Indicates whether this block is stacked, rather than absolutely positioned. + * @return true if it is stacked + */ + public boolean isStacked() { + return (getPositioning() == Block.STACK || getPositioning() == Block.RELATIVE); + } + /** * @return the start-indent trait */ @@ -119,6 +128,6 @@ public class Block extends BlockParent { Integer startIndent = (Integer)getTrait(Trait.START_INDENT); return (startIndent != null ? startIndent.intValue() : 0); } - + } diff --git a/src/java/org/apache/fop/area/BlockViewport.java b/src/java/org/apache/fop/area/BlockViewport.java index af994afd4..167e7c5b3 100644 --- a/src/java/org/apache/fop/area/BlockViewport.java +++ b/src/java/org/apache/fop/area/BlockViewport.java @@ -34,6 +34,15 @@ public class BlockViewport extends Block { * Create a new block viewport area. */ public BlockViewport() { + this(false); + } + + /** + * Create a new block viewport area. + * @param allowBPDUpdate true allows the BPD to be updated when children are added + */ + public BlockViewport(boolean allowBPDUpdate) { + this.allowBPDUpdate = allowBPDUpdate; } /** diff --git a/src/java/org/apache/fop/area/NormalFlow.java b/src/java/org/apache/fop/area/NormalFlow.java index 715a61cb0..c9fc8380a 100644 --- a/src/java/org/apache/fop/area/NormalFlow.java +++ b/src/java/org/apache/fop/area/NormalFlow.java @@ -37,7 +37,9 @@ public class NormalFlow extends BlockParent { /** {@inheritDoc} */ public void addBlock(Block block) { super.addBlock(block); - bpd += block.getAllocBPD(); + if (block.isStacked()) { + bpd += block.getAllocBPD(); + } } } -- cgit v1.2.3