firstLineStyle = ((FirstLineStyle) o).getStyle();
block.firstLineStyle = ((FirstLineStyle) o).getStyle();
    public Box layoutChildren(Context c, Box box) {        //u.p("starting to lay out the children");        /* resolved by ContentUtil if (LayoutUtil.isHiddenNode(box.getElement(), c)) {            return box;        }*/        List contentList = box.getContent().getChildContent(c);        if (contentList.size() == 0) return box;//we can do this if there is no content, right?        //TODO: unravel the mysteries of the layout hierarchy. Perhaps the Context should know if we are block-laying out or inline laying-out?        if (!box.isAnonymous()) {//this check should really be unnecessary when content layout is completed. tobe 2004-12-09            //This where the magic decision of creating AnonymousBlockBox is            //if (LayoutUtil.isBlockLayout(box.getElement(), c)) {            if (ContentUtil.isBlockContent(contentList)) {//this should be block layed out                return super.layoutChildren(c, box);            }        }                // calculate the initial position and dimensions        Box block = (Box) box;        Rectangle bounds = new Rectangle();        bounds.width = c.getExtents().width;        bounds.width -= box.margin.left + box.border.left + box.padding.left +                box.padding.right + box.border.right + box.margin.right;        validateBounds(bounds);        bounds.x = 0;        bounds.y = 0;        bounds.height = 0;        // prepare remaining width and first linebox        int remaining_width = bounds.width;        LineBox curr_line = newLine(box, bounds, null);        c.setFirstLine(true);        // account for text-indent        CalculatedStyle parentStyle = box.getContent().getStyle();//this should work already        remaining_width = TextIndent.doTextIndent(parentStyle, remaining_width, curr_line);                // more setup        LineBox prev_line = new LineBox();        prev_line.setParent(box);        prev_line.y = bounds.y;        prev_line.height = 0;        InlineBox prev_inline = null;        InlineBox prev_align_inline = null;        // adjust the first line for float tabs        remaining_width = FloatUtil.adjustForTab(c, prev_line, remaining_width);        CalculatedStyle currentStyle = parentStyle;        CascadedStyle firstLineStyle = null;        CascadedStyle firstLetterStyle = null;        boolean isFirstLetter = true;        // loop until no more nodes        while (contentList.size() > 0) {            Object o = contentList.get(0);            contentList.remove(0);            if (o instanceof FirstLineStyle) {//can actually only be the first object in list                firstLineStyle = ((FirstLineStyle) o).getStyle();                continue;            }            if (o instanceof FirstLetterStyle) {//can actually only be the first or second object in list                firstLetterStyle = ((FirstLetterStyle) o).getStyle();                continue;            }            Content currentContent = (Content) o;            // loop until no more text in this node            while (true) {                // debugging check                if (bounds.width < 0) {                    u.p("bounds width = " + bounds.width);                    u.dump_stack();                    System.exit(-1);                }                                // the crash warning code                if (bounds.width < 1) {                    u.p("warning. width < 1 " + bounds.width);                }                                // test if there is no more text in the current text node                // if there is a prev, and if the prev was part of this current node                if (prev_inline != null && prev_inline.getContent() == currentContent) {                    if (isEndOfBlock(prev_inline, currentContent)) {                        break;                    }                }                currentStyle = currentContent.getStyle();                // look at current inline                // break off the longest section that will fit                InlineBox new_inline = calculateInline(c, currentContent, remaining_width, bounds.width,                        prev_inline, prev_align_inline, isFirstLetter, firstLetterStyle, firstLineStyle);                // u.p("got back inline: " + new_inline);                isFirstLetter = false;                firstLetterStyle = null;                // if this inline needs to be on a new line                if (new_inline.break_before && !new_inline.floated) {                    remaining_width = bounds.width;                    saveLine(curr_line, currentStyle, prev_line, bounds.width, bounds.x, c, block, false);                    firstLineStyle = null;                    bounds.height += curr_line.height;                    prev_line = curr_line;                    curr_line = newLine(box, bounds, prev_line);                    remaining_width = FloatUtil.adjustForTab(c, curr_line, remaining_width);                }                                                // save the new inline to the list                curr_line.addChild(new_inline);                                                // calc new height of the line                // don't count the inline towards the line height and                // line baseline if it's a floating inline.                if (!(currentContent instanceof InlineBlockContent)) {                    if (!(currentContent instanceof FloatedBlockContent)) {                        adjustLineHeight(curr_line, new_inline);                    }                }                                // handle float                //FloatUtil.handleFloated( c, new_inline, curr_line, bounds.width, elem );                                // calc new width of the line                curr_line.width += new_inline.width;                // reduce the available width                remaining_width = remaining_width - new_inline.width;                                // if the last inline was at the end of a line, then go to next line                if (new_inline.break_after) {                    // then remaining_width = max_width                    remaining_width = bounds.width;                    // save the line                    saveLine(curr_line, currentStyle, prev_line, bounds.width, bounds.x, c, block, false);                    firstLineStyle = null;                    // increase bounds height to account for the new line                    bounds.height += curr_line.height;                    prev_line = curr_line;                    curr_line = newLine(box, bounds, prev_line);                    remaining_width = FloatUtil.adjustForTab(c, curr_line, remaining_width);                }                                                // set the inline to use for left alignment                if (!(currentContent instanceof FloatedBlockContent)) {                    prev_align_inline = new_inline;                }                prev_inline = new_inline;            }        }                // save the final line        saveLine(curr_line, currentStyle, prev_line, bounds.width, bounds.x, c, block, true);        finishBlock(block, curr_line, bounds);        return block;    }