private void doLayoutImpl(int availWidth, int availHeight) {
   if (availHeight != this.lastAvailHeight && availWidth != this.lastAvailWidth) {
     this.lastAvailHeight = availHeight;
     this.lastAvailWidth = availWidth;
     Insets insets = this.getInsets();
     int extraWidth = insets.right + insets.left;
     int blockWidth = availWidth - INDENT - extraWidth;
     int maxBlockWidth = blockWidth;
     ArrayList liDescendents = this.rootElement.getDescendents(new LiFilter());
     int size = liDescendents.size();
     this.removeAll();
     int y = insets.top;
     int newNesting = this.nesting + 1;
     for (int i = 0; i < size; i++) {
       HTMLElementImpl liElement = (HTMLElementImpl) liDescendents.get(i);
       HtmlBlock block = new HtmlBlock(newNesting, layoutArgs);
       this.add(block);
       block.setRootNode(liElement);
       Dimension renderSize = block.layoutFor(blockWidth, 0);
       int actualBlockWidth;
       if (renderSize.width > blockWidth) {
         actualBlockWidth = renderSize.width;
       } else {
         actualBlockWidth = blockWidth;
       }
       int blockHeight = renderSize.height;
       block.setBounds(insets.left + INDENT, y, actualBlockWidth, blockHeight);
       y += blockHeight + ITEM_SPACING;
       if (actualBlockWidth > maxBlockWidth) {
         maxBlockWidth = actualBlockWidth;
       }
     }
     this.preferredHeight = y - ITEM_SPACING + insets.bottom;
     this.preferredWidth = maxBlockWidth + INDENT + insets.left + insets.right;
   }
 }