if (child.getNodeType() == child.ELEMENT_NODE) {
if (child.getNodeType() == Node.ELEMENT_NODE) {
    public Box layoutChildren(Context c, Box box) {        BlockBox block = (BlockBox) box;        c.shrinkExtents(block);                // save the original height in case it        // has a fixed height        int original_height = block.height;        Element elem = (Element) box.getNode();        // prepare for the list items        int old_counter = c.getListCounter();        c.setListCounter(0);        // for each child        NodeList nl = elem.getChildNodes();        for (int i = 0; i < nl.getLength(); i++) {            Node child = nl.item(i);            // get the layout for this child            Layout layout = c.getLayout(child);            if (layout == null) {                continue;            }            if (layout instanceof NullLayout) {                continue;            }            if (c.getRenderingContext().getLayoutFactory().isBreak(child)) {                continue;            }            if (child.getNodeType() == child.COMMENT_NODE) {                continue;            }            Box child_box = null;            if (child.getNodeType() == child.ELEMENT_NODE) {                // update the counter for printing OL list items                c.setListCounter(c.getListCounter() + 1);                Element child_elem = (Element) child;                // execute the layout and get the return bounds                //c.parent_box = box;                c.placement_point = new Point(0, box.height);                c.getBlockFormattingContext().translate(0, box.height);                child_box = layout.layout(c, child_elem);                c.getBlockFormattingContext().translate(0, -box.height);                child_box.list_count = c.getListCounter();            } else {                // create anonymous block box                // prepare the node list of the text children                // call layout                //TODO: these casts seem risky (or at least, very non-encapsulated). Refactor.                child_box = ((AnonymousBoxLayout) layout).layout(c, elem, child);                // skip text children if the prev_child == anonymous block box                // because that means they were sucked into this block                Node last_node = ((AnonymousBlockBox) child_box).last_node;                // if anonymous box is only one node wide then skip this                // junk                if (child != last_node) {                    while (true) {                        i++;                        Node ch = nl.item(i);                        //u.p("trying to skip: " + ch);                        if (ch == last_node) {                            break;                        }                    }                }            }            box.addChild(child_box);            // set the child_box location            child_box.x = 0;            child_box.y = box.height;            //joshy fix the 'fixed' stuff later            // if fixed or abs then don't modify the final layout bounds            // because fixed elements are removed from normal flow            if (child_box.fixed) {                // put fixed positioning in later                Fixed.positionFixedChild(c, child_box);            }            if (child_box.isAbsolute()) {                Absolute.positionAbsoluteChild(c, child_box);            }                        // skip adjusting the parent box if the child            // doesn't affect flow layout            if (LayoutUtil.isOutsideNormalFlow(child_box)) {                continue;            }            // increase the final layout width if the child was greater            if (child_box.width > box.width) {                box.width = child_box.width;            }            // increase the final layout height by the height of the child            box.height += child_box.height;        }        c.addMaxWidth(box.width);        c.setListCounter(old_counter);        c.unshrinkExtents(block);        return block;    }