Browse Source

Fix for auto height on absolutely positioned block-containers.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198277 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Jeremias Maerki 19 years ago
parent
commit
5d33b067c4
1 changed files with 14 additions and 39 deletions
  1. 14
    39
      src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java

+ 14
- 39
src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java View File

@@ -36,7 +36,7 @@ import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.traits.MinOptMax;

/**
* LayoutManager for a block FO.
* LayoutManager for a block-container FO.
*/
public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
private BlockContainer fobj;
@@ -142,6 +142,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
return getAbsoluteBreakPoss(context);
}

autoHeight = false;
boolean rotated = (fobj.getReferenceOrientation() % 180 != 0); //vals[0] == 0.0;
referenceIPD = context.getRefIPD();
int maxbpd = context.getStackLimit().opt;
@@ -151,6 +152,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
allocBPD += getBPIndents();
} else {
allocBPD = maxbpd;
autoHeight = true;
}
if (width.getEnum() != EN_AUTO) {
allocIPD = width.getValue(); //this is the content-width
@@ -298,6 +300,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
LayoutManager curLM ; // currently active LM

MinOptMax stackSize = new MinOptMax();
autoHeight = false;

Point offset = getAbsOffset();
int allocBPD, allocIPD;
@@ -316,6 +319,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
if (abProps.bottom.getEnum() != EN_AUTO) {
allocBPD -= abProps.bottom.getValue();
}
} else {
autoHeight = true;
}
}
if (width.getEnum() != EN_AUTO) {
@@ -353,8 +358,6 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
fobj.getReferenceOrientation(),
fobj.getWritingMode(),
rect, relDims);
//referenceIPD = relDims.ipd + getIPIndents();

while ((curLM = getChildLM()) != null) {
// Make break positions and return blocks!
@@ -379,7 +382,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
// to the normal stacking
breakPoss.setStackingSize(new MinOptMax(0));

if (stackSize.opt > relDims.bpd) {
//TODO Maybe check for page overflow when autoHeight=true
if (!autoHeight & (stackSize.opt > relDims.bpd)) {
log.warn("Contents overflow block-container viewport: clipping");
if (fobj.getOverflow() == EN_HIDDEN) {
clip = true;
@@ -441,7 +445,11 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
viewportBlockArea.setCTM(absoluteCTM);
viewportBlockArea.setIPD(vpContentIPD);
viewportBlockArea.setBPD(vpContentBPD);
if (autoHeight) {
viewportBlockArea.setBPD(0);
} else {
viewportBlockArea.setBPD(vpContentBPD);
}
viewportBlockArea.setClip(clip);
viewportBlockArea.addTrait(Trait.SPACE_BEFORE, new Integer(getSpaceBefore()));

@@ -450,41 +458,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
Point offset = getAbsOffset();
viewportBlockArea.setXOffset(offset.x);
viewportBlockArea.setYOffset(offset.y);
autoHeight = false;
} else {
//double[] vals = absoluteCTM.toArray();
boolean rotated = (fobj.getReferenceOrientation() % 180 != 0); //vals[0] == 0.0;
if (rotated) {
autoHeight = false;
} else {
autoHeight = (height.getEnum() == EN_AUTO);
if (autoHeight) {
viewportBlockArea.setBPD(0);
}
}
/*
boolean rotated = vals[0] == 0.0;
if (rotated) {
viewportBlockArea.setIPD(vpContentIPD);
viewportBlockArea.setBPD(vpContentBPD);
viewportBlockArea.setClip(clip);
autoHeight = false;
} else if (vals[0] == -1.0) {
// need to set bpd to actual size for rotation
// and stacking
viewportBlockArea.setIPD(relDims.ipd);
if (height.getEnum() != EN_AUTO) {
viewportBlockArea.setBPD(relDims.bpd);
autoHeight = false;
}
viewportBlockArea.setClip(clip);
} else {
viewportBlockArea.setIPD(relDims.ipd);
if (height.getEnum() != EN_AUTO) {
viewportBlockArea.setBPD(relDims.bpd);
autoHeight = false;
}
}*/
//nop
}

curBlockArea = new Block();

Loading…
Cancel
Save