code: public Rectangle getContainingBlock()
      {
          if (cbox instanceof Viewport) //initial containing block
          {
              Rectangle visible = ((Viewport) cbox).getVisibleRect();
              return new Rectangle(0, 0, visible.width, visible.height);
          }
          else //static or relative position
              return cbox.getContentBounds();
      }
docs: Obtains the containing block bounds.
  @return the containing block bounds.