]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
State and parameter checking.
authorJeremias Maerki <jeremias@apache.org>
Wed, 10 Aug 2005 14:56:33 +0000 (14:56 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 10 Aug 2005 14:56:33 +0000 (14:56 +0000)
Update the BPD from the child, too.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/inlineblock@231253 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/area/inline/InlineBlockParent.java

index 0c284e7ff94c06a1aabd4f8576c0ccafc7549842..9934b131611d770fa4422d22eff9db6cf2369d65 100644 (file)
@@ -45,11 +45,17 @@ public class InlineBlockParent extends InlineArea {
      * @param childArea the child area to add
      */
     public void addChildArea(Area childArea) {
-        if (childArea instanceof Block && child == null) {
+        if (child != null) {
+            throw new IllegalStateException("InlineBlockParent may have only one child area.");
+        }
+        if (childArea instanceof Block) {
             child = (Block) childArea;
-            increaseIPD(childArea.getAllocIPD());
+            //Update extents from the child
+            setIPD(childArea.getAllocIPD());
+            setBPD(childArea.getAllocBPD());
         } else {
-            // TODO: log error, raise exception?
+            throw new IllegalArgumentException("The child of an InlineBlockParent must be a"
+                    + " Block area");
         }
     }