} } }  if (blockList == null) {
inlineList.add(new StylePop()); } } }   if (isBlockContent(inlineList)) { if (blockList == null) blockList = new LinkedList(); blockList.addAll(resolveRunInContent(inlineList, parentElement, parentStyle)); inlineList = new LinkedList(); }  if (blockList == null) {
    static List getChildContentList(Context c, Content parent) {        List inlineList = new LinkedList();        List blockList = null;        FirstLineStyle firstLineStyle = null;        FirstLetterStyle firstLetterStyle = null;        TextContent textContent = null;        CascadedStyle parentStyle = parent.getStyle();        Element parentElement = parent.getElement();        if (mayHaveFirstLine(parentStyle)) {            //put in a marker if there is first-line styling            CascadedStyle firstLine = c.css.getPseudoElementStyle(parentElement, "first-line");            if (firstLine != null) {                firstLineStyle = new FirstLineStyle(firstLine);            }        }        if (mayHaveFirstLetter(parentStyle)) {            //put in a marker if there is first-letter styling            CascadedStyle firstLetter = c.css.getPseudoElementStyle(parentElement, "first-letter");            if (firstLetter != null) {                firstLetterStyle = new FirstLetterStyle(firstLetter);            }        }        if (parentElement != null) {            //TODO: before and after may be block!            //<br/> handling should be done by :before content            CascadedStyle before = c.css.getPseudoElementStyle(parentElement, "before");            if (before != null && before.hasProperty(CSSName.CONTENT)) {                String content = before.propertyByName(CSSName.CONTENT).getValue().getCssText();                if (!content.equals("")) {                    if (textContent != null) {                        inlineList.add(textContent);                        textContent = null;                    }                    textContent = new TextContent((Element) parentElement);                    textContent.append(content.replaceAll("\\\\A", "\n"));                    inlineList.add(textContent);                    textContent = null;                }                //do not reset style here, because if this element is empty, we will not have changed context            }        }        Node node = parentElement;        if (node == null) node = ((BodyContent) parent).getNode();        NodeList children = node.getChildNodes();        //each child node can result in only one addition to content        for (int i = 0; i < children.getLength(); i++) {            Node curr = children.item(i);            if (curr.getNodeType() == Node.TEXT_NODE) {                String text = curr.getNodeValue();                if (textContent == null) textContent = new TextContent((Element) curr.getParentNode());                textContent.append(text);                continue;            }            if (curr.getNodeType() != Node.ELEMENT_NODE) break;//must be a comment or pi or something            Element elem = (Element) curr;            CascadedStyle style = c.css.getCascadedStyle(elem);            if (isHidden(style)) {                continue;//at least for now, don't generate hidden content            }            //TODO: this replaced thing is Namespace-dependent                if (LayoutUtil.isReplaced(c, curr)) {                // u.p("adding replaced: " + curr);                if (textContent != null) {                    inlineList.add(textContent);                    textContent = null;                }                inlineList.add(new ReplacedContent((Element) curr, style));                continue;            }            //TODO: check CSS-spec 9.7 for computing values for floats            if (isFloated(style)) {                // u.p("adding floated block: " + curr);                if (textContent != null) {                    inlineList.add(textContent);                    textContent = null;                }                inlineList.add(new FloatedBlockContent((Element) curr, style));                continue;            }            if (isInlineBlock(style)) {                //treat it like a replaced element                if (textContent != null) {                    inlineList.add(textContent);                    textContent = null;                }                inlineList.add(new ReplacedContent(elem, style));                continue;            }            if (isBlockLevel(style)) {                if (textContent != null) {                    inlineList.add(textContent);                    textContent = null;                }                if (blockList == null) blockList = new LinkedList();                //TODO: handle run-in here                if (inlineList.size() != 0) {                    blockList.add(new AnonymousBlockContent(parentElement, parentStyle, inlineList));                    inlineList = new LinkedList();                }                blockList.add(new BlockContent((Element) curr, style));                continue;            }            //TODO: handle run-in content separately            //TODO: how about Absolute and Fixed children?            //TODO:list-items, tables, etc.            //if we get here, we have inline content, need to get into it.            Content inline = new InlineContent(elem, style);            List childList = inline.getChildContent(c);            if (isBlockContent(childList)) {                //need to put current inlineList in front, with a StylePush appended                if (textContent != null) {                    inlineList.add(textContent);                    textContent = null;                }                inlineList.add(new StylePush(style));                for (Iterator ci = childList.iterator(); ci.hasNext();) {                    Object o = ci.next();                    if (o instanceof BlockContent) break;                    ci.remove();//have to take it out to avoid duplicates                    if (o instanceof AnonymousBlockContent) {                        inlineList.addAll(((AnonymousBlockContent) o).getChildContent(c));                    } else {                        inlineList.add(o);                    }                }                if (blockList == null) blockList = new LinkedList();                //TODO: handle run-in here                if (inlineList.size() != 0) {                    blockList.add(new AnonymousBlockContent(parentElement, parentStyle, inlineList));                    inlineList = new LinkedList();                }                //extract any trailing AnonymousBlock and put it in the inlineList                Object last = childList.get(childList.size() - 1);                if (last instanceof AnonymousBlockContent) {                    inlineList.addAll(((AnonymousBlockContent) last).getChildContent(c));                    childList.remove(childList.size() - 1);                }                //add the rest of the children                blockList.addAll(childList);                //append StylePop                inlineList.add(new StylePop());            } else {                inlineList.add(new StylePush(style));                inlineList.addAll(childList);                inlineList.add(new StylePop());            }        }        if (textContent != null) {            inlineList.add(textContent);            textContent = null;        }        if (parentElement != null) {            //TODO: after may be block!            CascadedStyle after = c.css.getPseudoElementStyle(parentElement, "after");            if (after != null && after.hasProperty(CSSName.CONTENT)) {                String content = after.propertyByName(CSSName.CONTENT).getValue().getCssText();                if (!content.equals("")) {                    textContent = new TextContent((Element) parentElement);                    textContent.append(content.replaceAll("\\\\A", "\n"));                    inlineList.add(textContent);                    textContent = null;                }            }        }        if (blockList == null) {//this was inline content            if (firstLetterStyle != null) {                inlineList.add(0, firstLetterStyle);            }            if (firstLineStyle != null) {                inlineList.add(0, firstLineStyle);            }            return inlineList;        } else {            if (inlineList.size() != 0) {                blockList.add(new AnonymousBlockContent(parentElement, parentStyle, inlineList));            }            if (firstLetterStyle != null) {                blockList.add(0, firstLetterStyle);            }            if (firstLineStyle != null) {                blockList.add(0, firstLineStyle);            }            return blockList;        }    }