]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
An attempt at helpful error output when the top/left/bottom/right properties on block...
authorJeremias Maerki <jeremias@apache.org>
Sun, 21 Aug 2005 14:10:59 +0000 (14:10 +0000)
committerJeremias Maerki <jeremias@apache.org>
Sun, 21 Aug 2005 14:10:59 +0000 (14:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@234204 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java

index 16a94d4bc7605ecdc21582fe9ba9d08fb81317fd..a183732a38501087b5cd92e60afeb7302c85b8c3 100644 (file)
@@ -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;
+                }
             }
         }