From: Jeremias Maerki Date: Wed, 10 Aug 2005 14:56:33 +0000 (+0000) Subject: State and parameter checking. X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=65c0f475487bf239cd625808f85597fc238aebee;p=xmlgraphics-fop.git State and parameter checking. 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 --- diff --git a/src/java/org/apache/fop/area/inline/InlineBlockParent.java b/src/java/org/apache/fop/area/inline/InlineBlockParent.java index 0c284e7ff..9934b1316 100644 --- a/src/java/org/apache/fop/area/inline/InlineBlockParent.java +++ b/src/java/org/apache/fop/area/inline/InlineBlockParent.java @@ -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"); } }