aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-08-21 14:10:59 +0000
committerJeremias Maerki <jeremias@apache.org>2005-08-21 14:10:59 +0000
commit33c07d72cd5944284971e04e41beddbd1406ea3a (patch)
treec33eff390856f28d59bd740e701e9fc33efb9b12
parentf0099e5686c2d711522e7fee57aba9f6f8224616 (diff)
downloadxmlgraphics-fop-33c07d72cd5944284971e04e41beddbd1406ea3a.tar.gz
xmlgraphics-fop-33c07d72cd5944284971e04e41beddbd1406ea3a.zip
An attempt at helpful error output when the top/left/bottom/right properties on block-containers are not right.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@234204 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java46
1 files changed, 42 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index 16a94d4bc..a183732a3 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -342,14 +342,33 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
} else {
allocBPD = 0;
if (abProps.bottom.getEnum() != EN_AUTO) {
+ int availHeight;
if (isFixed()) {
- allocBPD = (int)getCurrentPV().getViewArea().getHeight();
+ availHeight = (int)getCurrentPV().getViewArea().getHeight();
} else {
- allocBPD = context.getStackLimit().opt;
+ availHeight = context.getStackLimit().opt;
}
+ allocBPD = availHeight;
allocBPD -= offset.y;
if (abProps.bottom.getEnum() != EN_AUTO) {
allocBPD -= abProps.bottom.getValue();
+ if (allocBPD < 0) {
+ log.error("The current combination of top and bottom properties results"
+ + " in a negative extent for the block-container. 'bottom' may be"
+ + " at most " + (allocBPD + abProps.bottom.getValue()) + " mpt,"
+ + " but was actually " + abProps.bottom.getValue() + " mpt."
+ + " The nominal available height is " + availHeight + " mpt.");
+ allocBPD = 0;
+ }
+ } else {
+ if (allocBPD < 0) {
+ log.error("The current combination of top and bottom properties results"
+ + " in a negative extent for the block-container. 'top' may be"
+ + " at most " + availHeight + " mpt,"
+ + " but was actually " + offset.y + " mpt."
+ + " The nominal available height is " + availHeight + " mpt.");
+ allocBPD = 0;
+ }
}
} else {
autoHeight = true;
@@ -359,16 +378,35 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
allocIPD = width.getValue(); //this is the content-width
allocIPD += getIPIndents();
} else {
+ int availWidth;
if (isFixed()) {
- allocIPD = (int)getCurrentPV().getViewArea().getWidth();
+ availWidth = (int)getCurrentPV().getViewArea().getWidth();
} else {
- allocIPD = context.getRefIPD();
+ availWidth = context.getRefIPD();
}
+ allocIPD = availWidth;
if (abProps.left.getEnum() != EN_AUTO) {
allocIPD -= abProps.left.getValue();
}
if (abProps.right.getEnum() != EN_AUTO) {
allocIPD -= abProps.right.getValue();
+ if (allocIPD < 0) {
+ log.error("The current combination of left and right properties results"
+ + " in a negative extent for the block-container. 'right' may be"
+ + " at most " + (allocIPD + abProps.right.getValue()) + " mpt,"
+ + " but was actually " + abProps.right.getValue() + " mpt."
+ + " The nominal available width is " + availWidth + " mpt.");
+ allocIPD = 0;
+ }
+ } else {
+ if (allocIPD < 0) {
+ log.error("The current combination of left and right properties results"
+ + " in a negative extent for the block-container. 'left' may be"
+ + " at most " + allocIPD + " mpt,"
+ + " but was actually " + abProps.left.getValue() + " mpt."
+ + " The nominal available width is " + availWidth + " mpt.");
+ allocIPD = 0;
+ }
}
}