code: private void createAnonymousBlocks(BlockBox root)
      {
          Vector<Box> nest = new Vector<Box>();
          ElementBox adiv = null;
          for (int i = 0; i < root.getSubBoxNumber(); i++)
          {
              Box sub = root.getSubBox(i);
              if (sub.isBlock())
              {
                  if (adiv != null && !adiv.isempty)
                  {
                      normalizeBox(adiv); //normalize even the newly created blocks
                      removeTrailingWhitespaces(adiv);
                  }
                  adiv = null;
                  nest.add(sub);
              }
              else if (adiv != null || !(sub instanceof InlineBox) || !sub.isWhitespace()) //omit whitespace inline boxes at the beginning of the blocks
              {
                  if (adiv == null)
                  {
                      adiv = createAnonymousBox(root, sub, true);
                      nest.add(adiv);
                  }
                  if (sub.isDisplayed() && !sub.isEmpty()) 
                  { 
                      adiv.isempty = false;
                      adiv.displayed = true;
                  }
                  adiv.addSubBox(sub);
              }
              else
                  sub.setContainingBlockBox(null);
          }
          if (adiv != null && !adiv.isempty)
          {
              normalizeBox(adiv); //normalize even the newly created blocks
              removeTrailingWhitespaces(adiv);
          }
          root.nested = nest;
          root.endChild = nest.size();
      }
docs: Creates anonymous block boxes if the a block box contains both the inline
  and the block child boxes. The child boxes of the specified root
  are processed and the inline boxes are grouped in a newly created
  anonymous <code>div</code> boxes.
  @param root the root box