code: private Rectangular computeContentBounds()
      {
          Box box = getBox();
          Rectangular ret = null;
          
          if (box instanceof Viewport)
          {
              ret = new RectangularZ(((Viewport) box).getClippedBounds(), zoom);
          }
          else if (box instanceof ElementBox)
          {
              ElementBox elem = (ElementBox) box;
              //at least one border - take the border bounds
              //TODO: when only one border is present, we shouldn't take the whole border box? 
              if (elem.getBorder().top > 0 || elem.getBorder().left > 0 ||
                  elem.getBorder().bottom > 0 || elem.getBorder().right > 0)
              {
                  ret = new RectangularZ(elem.getAbsoluteBorderBounds(), zoom);
              }
              //no border
              else
              {
                  ret = new RectangularZ(elem.getAbsoluteBackgroundBounds(), zoom);
              }
          }
          else //not an element - return the whole box
              ret = new RectangularZ(box.getAbsoluteBounds(), zoom);
  
          //clip with the clipping bounds
          if (box.getClipBlock() != null)
          {
              Rectangular clip = new RectangularZ(box.getClipBlock().getClippedContentBounds(), zoom);
              ret = ret.intersection(clip);
          }
          
          return ret;
      }
docs: Computes node the content bounds. They correspond to the background bounds
  however, when a border is present, it is included in the contents. Moreover,
  the box is clipped by its clipping box.