code: private Rectangle getCompleteBoxAllocation(Box b)
      {
          Rectangle ret = b.getAbsoluteBounds();
          if (b instanceof ElementBox)
          {
              ElementBox eb = (ElementBox) b;
              for (int i = eb.getStartChild(); i < eb.getEndChild(); i++)
              {
                  Box child = eb.getSubBox(i);
                  if (child.isVisible())
                  {
                      Rectangle r = getCompleteBoxAllocation(child);
                      ret.add(r);
                  }
              }
          }
          return ret.intersection(b.getClipBlock().getClippedContentBounds());
      }
docs: Obtains the allocation of a box together with all its child boxes.
  @param b the box
  @return the smallest rectangle containing the box and all its child boxes